@innosolutions/inno-calendar 1.0.59 → 1.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/AGENT.md +1783 -1721
  2. package/README.md +279 -235
  3. package/dist/agenda-widget-D6E-NQK-.cjs +2 -0
  4. package/dist/agenda-widget-D6E-NQK-.cjs.map +1 -0
  5. package/dist/{agenda-widget-wrZfO67A.js → agenda-widget-DVj4CEZE.js} +1297 -1279
  6. package/dist/agenda-widget-DVj4CEZE.js.map +1 -0
  7. package/dist/components/event/event-card.d.ts.map +1 -1
  8. package/dist/components/index.cjs +1 -1
  9. package/dist/components/index.mjs +2 -2
  10. package/dist/components/primitives/scroll-navigator.d.ts +3 -1
  11. package/dist/components/primitives/scroll-navigator.d.ts.map +1 -1
  12. package/dist/components/views/timeline-view.d.ts +1 -1
  13. package/dist/components/views/timeline-view.d.ts.map +1 -1
  14. package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
  15. package/dist/core/context/slot-selection-context.d.ts +2 -0
  16. package/dist/core/context/slot-selection-context.d.ts.map +1 -1
  17. package/dist/core/index.cjs +1 -1
  18. package/dist/core/index.mjs +115 -114
  19. package/dist/core/types.d.ts +6 -18
  20. package/dist/core/types.d.ts.map +1 -1
  21. package/dist/core/utils/event-utils.d.ts.map +1 -1
  22. package/dist/core/utils/index.d.ts +1 -0
  23. package/dist/core/utils/index.d.ts.map +1 -1
  24. package/dist/core/utils/react-node-utils.d.ts +14 -0
  25. package/dist/core/utils/react-node-utils.d.ts.map +1 -0
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.mjs +207 -206
  28. package/dist/position-utils-BQpbtF6N.cjs +2 -0
  29. package/dist/position-utils-BQpbtF6N.cjs.map +1 -0
  30. package/dist/position-utils-DMVQFywD.js +936 -0
  31. package/dist/position-utils-DMVQFywD.js.map +1 -0
  32. package/dist/presets/index.cjs +1 -1
  33. package/dist/presets/index.mjs +1 -1
  34. package/dist/slot-selection-context-CRstOosL.js +604 -0
  35. package/dist/slot-selection-context-CRstOosL.js.map +1 -0
  36. package/dist/slot-selection-context-DBCZI2Dn.cjs +2 -0
  37. package/dist/slot-selection-context-DBCZI2Dn.cjs.map +1 -0
  38. package/dist/styles/index.css +1 -1
  39. package/dist/{tailwind-calendar-CVuxWXLY.js → tailwind-calendar-CNhXkxzW.js} +80 -80
  40. package/dist/{tailwind-calendar-CVuxWXLY.js.map → tailwind-calendar-CNhXkxzW.js.map} +1 -1
  41. package/dist/tailwind-calendar-VRvPJQwa.cjs +2 -0
  42. package/dist/{tailwind-calendar-DoG6s3PJ.cjs.map → tailwind-calendar-VRvPJQwa.cjs.map} +1 -1
  43. package/dist/{use-calendar-Clo9DFK4.js → use-calendar-D8XaVe44.js} +69 -69
  44. package/dist/{use-calendar-Clo9DFK4.js.map → use-calendar-D8XaVe44.js.map} +1 -1
  45. package/dist/use-calendar-DkT1_V3j.cjs +2 -0
  46. package/dist/{use-calendar-BEuelmSu.cjs.map → use-calendar-DkT1_V3j.cjs.map} +1 -1
  47. package/dist/{use-slot-selection-BCZKnZSM.js → use-slot-selection-CWRk_17s.js} +32 -32
  48. package/dist/{use-slot-selection-BCZKnZSM.js.map → use-slot-selection-CWRk_17s.js.map} +1 -1
  49. package/dist/use-slot-selection-Dj_tWg1O.cjs +2 -0
  50. package/dist/{use-slot-selection-Bwqwjiaq.cjs.map → use-slot-selection-Dj_tWg1O.cjs.map} +1 -1
  51. package/dist/utils.cjs +1 -1
  52. package/dist/utils.cjs.map +1 -1
  53. package/dist/utils.mjs +117 -920
  54. package/dist/utils.mjs.map +1 -1
  55. package/dist/week-view-C1Vu2ErD.cjs +11 -0
  56. package/dist/week-view-C1Vu2ErD.cjs.map +1 -0
  57. package/dist/{week-view-C1FxF_nk.js → week-view-DY167Wok.js} +1084 -1043
  58. package/dist/week-view-DY167Wok.js.map +1 -0
  59. package/package.json +138 -138
  60. package/dist/agenda-widget-BxZU4eGL.cjs +0 -2
  61. package/dist/agenda-widget-BxZU4eGL.cjs.map +0 -1
  62. package/dist/agenda-widget-wrZfO67A.js.map +0 -1
  63. package/dist/slot-selection-context-BwghpxKA.js +0 -597
  64. package/dist/slot-selection-context-BwghpxKA.js.map +0 -1
  65. package/dist/slot-selection-context-CHSaOPWP.cjs +0 -2
  66. package/dist/slot-selection-context-CHSaOPWP.cjs.map +0 -1
  67. package/dist/tailwind-calendar-DoG6s3PJ.cjs +0 -2
  68. package/dist/use-calendar-BEuelmSu.cjs +0 -2
  69. package/dist/use-slot-selection-Bwqwjiaq.cjs +0 -2
  70. package/dist/week-view-Bzpbti1B.cjs +0 -11
  71. package/dist/week-view-Bzpbti1B.cjs.map +0 -1
  72. package/dist/week-view-C1FxF_nk.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../src/core/constants.ts","../src/core/utils/date-utils.ts","../src/core/utils/event-utils.ts","../src/core/utils/grid-utils.ts","../src/core/utils/position-utils.ts"],"sourcesContent":["/**\n * Constants for @inno/calendar\n *\n * Default values, view configurations, and color mappings.\n */\n\nimport type {\n\tICalendarPreferences,\n\tIViewConfig,\n\tIVisibleHours,\n\tTCalendarView,\n\tTEventColor,\n} from './types';\n\n// ============================================================================\n// CALENDAR VIEWS\n// ============================================================================\n\n/**\n * All available calendar views\n */\nexport const CALENDAR_VIEWS: TCalendarView[] = [\n\t'day',\n\t'week',\n\t'month',\n\t'year',\n\t'agenda',\n\t'resource-day',\n\t'resource-week',\n\t'timeline-day',\n\t'timeline-week',\n];\n\n// ============================================================================\n// DEFAULT PREFERENCES\n// ============================================================================\n\n/**\n * Default calendar preferences\n */\nexport const DEFAULT_PREFERENCES: ICalendarPreferences = {\n\tstartHour: 8,\n\tendHour: 18,\n\tfirstDayOfWeek: 1, // Monday\n\tslotDuration: 30,\n\tshowWeekends: true,\n\ttimeFormat: '24h',\n\tbadgeVariant: 'colored',\n\tshowCanceledEvents: false,\n};\n\n/**\n * Default visible hours\n */\nexport const DEFAULT_VISIBLE_HOURS: IVisibleHours = {\n\tstartHour: 0,\n\tendHour: 24,\n};\n\n/**\n * Default business hours range (used as a fallback for visible hours)\n */\nexport const DEFAULT_BUSINESS_HOURS: IVisibleHours = {\n\tstartHour: 8,\n\tendHour: 18,\n};\n\n// ============================================================================\n// VIEW CONFIGURATIONS\n// ============================================================================\n\n/**\n * Default configuration for each view type\n */\nexport const DEFAULT_VIEW_CONFIGS: Record<TCalendarView, IViewConfig> = {\n\tday: {\n\t\ttype: 'day',\n\t\tslotMinTime: '00:00',\n\t\tslotMaxTime: '24:00',\n\t\tslotDuration: '00:30:00',\n\t\tscrollTime: '08:00:00',\n\t\tallDaySlot: true,\n\t},\n\tweek: {\n\t\ttype: 'week',\n\t\tslotMinTime: '00:00',\n\t\tslotMaxTime: '24:00',\n\t\tslotDuration: '00:30:00',\n\t\tscrollTime: '08:00:00',\n\t\tdayMaxEventRows: 3,\n\t\tallDaySlot: true,\n\t},\n\tmonth: {\n\t\ttype: 'month',\n\t\tdayMaxEventRows: 4,\n\t\teventMaxStack: 3,\n\t\tallDaySlot: false,\n\t},\n\tyear: {\n\t\ttype: 'year',\n\t\tdayMaxEventRows: 2,\n\t\tallDaySlot: false,\n\t},\n\tagenda: {\n\t\ttype: 'agenda',\n\t\tallDaySlot: false,\n\t},\n\t'resource-day': {\n\t\ttype: 'resource-day',\n\t\tslotMinTime: '00:00',\n\t\tslotMaxTime: '24:00',\n\t\tslotDuration: '00:30:00',\n\t\tscrollTime: '08:00:00',\n\t\tallDaySlot: true,\n\t},\n\t'resource-week': {\n\t\ttype: 'resource-week',\n\t\tslotMinTime: '00:00',\n\t\tslotMaxTime: '24:00',\n\t\tslotDuration: '00:30:00',\n\t\tscrollTime: '08:00:00',\n\t\tallDaySlot: true,\n\t},\n\t'timeline-day': {\n\t\ttype: 'timeline-day',\n\t\tslotDuration: '01:00:00',\n\t},\n\t'timeline-3day': {\n\t\ttype: 'timeline-3day',\n\t\tslotDuration: '01:00:00',\n\t},\n\t'timeline-week': {\n\t\ttype: 'timeline-week',\n\t\tslotDuration: '01:00:00',\n\t},\n};\n\n// ============================================================================\n// EVENT COLORS\n// ============================================================================\n\n/**\n * Event color palette with hex values\n */\nexport const EVENT_COLORS: Record<TEventColor, string> = {\n\tblue: '#3b82f6',\n\tgreen: '#22c55e',\n\tred: '#ef4444',\n\tyellow: '#eab308',\n\tpurple: '#a855f7',\n\torange: '#f97316',\n\tpink: '#ec4899',\n\tteal: '#14b8a6',\n\tgray: '#6b7280',\n\tindigo: '#6366f1',\n};\n\n/**\n * TailwindCSS class mappings for event colors\n */\nexport const EVENT_COLOR_CLASSES: Record<\n\tTEventColor,\n\t{ bg: string; text: string; border: string }\n> = {\n\tblue: { bg: 'bg-blue-100', text: 'text-blue-800', border: 'border-blue-300' },\n\tgreen: { bg: 'bg-green-100', text: 'text-green-800', border: 'border-green-300' },\n\tred: { bg: 'bg-red-100', text: 'text-red-800', border: 'border-red-300' },\n\tyellow: { bg: 'bg-yellow-100', text: 'text-yellow-800', border: 'border-yellow-300' },\n\tpurple: { bg: 'bg-purple-100', text: 'text-purple-800', border: 'border-purple-300' },\n\torange: { bg: 'bg-orange-100', text: 'text-orange-800', border: 'border-orange-300' },\n\tpink: { bg: 'bg-pink-100', text: 'text-pink-800', border: 'border-pink-300' },\n\tteal: { bg: 'bg-teal-100', text: 'text-teal-800', border: 'border-teal-300' },\n\tgray: { bg: 'bg-gray-100', text: 'text-gray-800', border: 'border-gray-300' },\n\tindigo: { bg: 'bg-indigo-100', text: 'text-indigo-800', border: 'border-indigo-300' },\n};\n\n/**\n * Map hex colors to event color names\n */\nexport const HEX_TO_EVENT_COLOR: Record<string, TEventColor> = {\n\t'#3b82f6': 'blue',\n\t'#22c55e': 'green',\n\t'#ef4444': 'red',\n\t'#eab308': 'yellow',\n\t'#a855f7': 'purple',\n\t'#f97316': 'orange',\n\t'#ec4899': 'pink',\n\t'#14b8a6': 'teal',\n\t'#6b7280': 'gray',\n\t'#6366f1': 'indigo',\n};\n\n// ============================================================================\n// TIME CONSTANTS\n// ============================================================================\n\n/**\n * Hours in a day\n */\nexport const HOURS_IN_DAY = 24;\n\n/**\n * Minutes in an hour\n */\nexport const MINUTES_IN_HOUR = 60;\n\n/**\n * Milliseconds in a minute\n */\nexport const MS_PER_MINUTE = 60 * 1000;\n\n/**\n * Milliseconds in an hour\n */\nexport const MS_PER_HOUR = 60 * MS_PER_MINUTE;\n\n/**\n * Milliseconds in a day\n */\nexport const MS_PER_DAY = 24 * MS_PER_HOUR;\n\n// ============================================================================\n// GRID CONSTANTS\n// ============================================================================\n\n/**\n * Default hour height in pixels for time grid views\n */\nexport const DEFAULT_HOUR_HEIGHT = 64;\n\n/**\n * Default slot height in pixels\n */\nexport const DEFAULT_SLOT_HEIGHT = 32;\n\n/**\n * Default header height in pixels\n */\nexport const DEFAULT_HEADER_HEIGHT = 56;\n\n/**\n * Default resource column width in pixels\n */\nexport const DEFAULT_RESOURCE_WIDTH = 200;\n\n/**\n * Minimum event height in pixels\n */\nexport const MIN_EVENT_HEIGHT = 20;\n","/**\n * Date Utilities for @inno/calendar\n *\n * Pure functions for date manipulation using native Date API.\n * No external dependencies.\n */\n\nimport type { TWorkingHours } from '../types';\n\n// Re-export TWorkingHours for convenience\nexport type { TWorkingHours };\n\n// ============================================================================\n// DAY OPERATIONS\n// ============================================================================\n\n/**\n * Get start of day (00:00:00.000)\n */\nexport function startOfDay(date: Date): Date {\n\tconst result = new Date(date);\n\tresult.setHours(0, 0, 0, 0);\n\treturn result;\n}\n\n/**\n * Get end of day (23:59:59.999)\n */\nexport function endOfDay(date: Date): Date {\n\tconst result = new Date(date);\n\tresult.setHours(23, 59, 59, 999);\n\treturn result;\n}\n\n/**\n * Add days to a date\n */\nexport function addDays(date: Date, days: number): Date {\n\tconst result = new Date(date);\n\tresult.setDate(result.getDate() + days);\n\treturn result;\n}\n\n/**\n * Subtract days from a date\n */\nexport function subDays(date: Date, days: number): Date {\n\treturn addDays(date, -days);\n}\n\n/**\n * Check if two dates are the same day\n */\nexport function isSameDay(date1: Date, date2: Date): boolean {\n\treturn (\n\t\tdate1.getFullYear() === date2.getFullYear() &&\n\t\tdate1.getMonth() === date2.getMonth() &&\n\t\tdate1.getDate() === date2.getDate()\n\t);\n}\n\n/**\n * Check if date is today\n */\nexport function isToday(date: Date): boolean {\n\treturn isSameDay(date, new Date());\n}\n\n/**\n * Get day of week (0-6, where 0 is Sunday)\n */\nexport function getDayOfWeek(date: Date): number {\n\treturn date.getDay();\n}\n\n/**\n * Check if date is a weekend\n */\nexport function isWeekend(date: Date): boolean {\n\tconst day = date.getDay();\n\treturn day === 0 || day === 6;\n}\n\n// ============================================================================\n// WEEK OPERATIONS\n// ============================================================================\n\n/**\n * Get start of week\n */\nexport function startOfWeek(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1): Date {\n\tconst result = new Date(date);\n\tconst day = result.getDay();\n\tconst diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n\tresult.setDate(result.getDate() - diff);\n\tresult.setHours(0, 0, 0, 0);\n\treturn result;\n}\n\n/**\n * Get end of week\n */\nexport function endOfWeek(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1): Date {\n\tconst result = startOfWeek(date, weekStartsOn);\n\tresult.setDate(result.getDate() + 6);\n\tresult.setHours(23, 59, 59, 999);\n\treturn result;\n}\n\n/**\n * Add weeks to a date\n */\nexport function addWeeks(date: Date, weeks: number): Date {\n\treturn addDays(date, weeks * 7);\n}\n\n/**\n * Subtract weeks from a date\n */\nexport function subWeeks(date: Date, weeks: number): Date {\n\treturn addDays(date, -weeks * 7);\n}\n\n/**\n * Get week number in year (ISO 8601)\n */\nexport function getWeekNumber(date: Date): number {\n\tconst d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));\n\tconst dayNum = d.getUTCDay() || 7;\n\td.setUTCDate(d.getUTCDate() + 4 - dayNum);\n\tconst yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));\n\treturn Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);\n}\n\n/**\n * Check if two dates are in the same week\n */\nexport function isSameWeek(\n\tdate1: Date,\n\tdate2: Date,\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1\n): boolean {\n\tconst start1 = startOfWeek(date1, weekStartsOn);\n\tconst start2 = startOfWeek(date2, weekStartsOn);\n\treturn isSameDay(start1, start2);\n}\n\n// ============================================================================\n// MONTH OPERATIONS\n// ============================================================================\n\n/**\n * Get start of month\n */\nexport function startOfMonth(date: Date): Date {\n\tconst result = new Date(date);\n\tresult.setDate(1);\n\tresult.setHours(0, 0, 0, 0);\n\treturn result;\n}\n\n/**\n * Get end of month\n */\nexport function endOfMonth(date: Date): Date {\n\tconst result = new Date(date.getFullYear(), date.getMonth() + 1, 0);\n\tresult.setHours(23, 59, 59, 999);\n\treturn result;\n}\n\n/**\n * Add months to a date\n */\nexport function addMonths(date: Date, months: number): Date {\n\tconst result = new Date(date);\n\tresult.setMonth(result.getMonth() + months);\n\treturn result;\n}\n\n/**\n * Subtract months from a date\n */\nexport function subMonths(date: Date, months: number): Date {\n\treturn addMonths(date, -months);\n}\n\n/**\n * Get number of days in a month\n */\nexport function getDaysInMonth(date: Date): number {\n\treturn new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();\n}\n\n/**\n * Check if two dates are in the same month\n */\nexport function isSameMonth(date1: Date, date2: Date): boolean {\n\treturn date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth();\n}\n\n// ============================================================================\n// YEAR OPERATIONS\n// ============================================================================\n\n/**\n * Get start of year\n */\nexport function startOfYear(date: Date): Date {\n\treturn new Date(date.getFullYear(), 0, 1, 0, 0, 0, 0);\n}\n\n/**\n * Get end of year\n */\nexport function endOfYear(date: Date): Date {\n\treturn new Date(date.getFullYear(), 11, 31, 23, 59, 59, 999);\n}\n\n/**\n * Add years to a date\n */\nexport function addYears(date: Date, years: number): Date {\n\tconst result = new Date(date);\n\tresult.setFullYear(result.getFullYear() + years);\n\treturn result;\n}\n\n/**\n * Subtract years from a date\n */\nexport function subYears(date: Date, years: number): Date {\n\treturn addYears(date, -years);\n}\n\n/**\n * Check if two dates are in the same year\n */\nexport function isSameYear(date1: Date, date2: Date): boolean {\n\treturn date1.getFullYear() === date2.getFullYear();\n}\n\n// ============================================================================\n// TIME OPERATIONS\n// ============================================================================\n\n/**\n * Add hours to a date\n */\nexport function addHours(date: Date, hours: number): Date {\n\tconst result = new Date(date);\n\tresult.setHours(result.getHours() + hours);\n\treturn result;\n}\n\n/**\n * Add minutes to a date\n */\nexport function addMinutes(date: Date, minutes: number): Date {\n\tconst result = new Date(date);\n\tresult.setMinutes(result.getMinutes() + minutes);\n\treturn result;\n}\n\n/**\n * Set time on a date\n */\nexport function setTime(date: Date, hours: number, minutes = 0, seconds = 0): Date {\n\tconst result = new Date(date);\n\tresult.setHours(hours, minutes, seconds, 0);\n\treturn result;\n}\n\n/**\n * Get time as decimal hours (e.g., 14:30 = 14.5)\n */\nexport function getDecimalHours(date: Date): number {\n\treturn date.getHours() + date.getMinutes() / 60;\n}\n\n// ============================================================================\n// COMPARISON OPERATIONS\n// ============================================================================\n\n/**\n * Check if date is before another date\n */\nexport function isBefore(date: Date, dateToCompare: Date): boolean {\n\treturn date.getTime() < dateToCompare.getTime();\n}\n\n/**\n * Check if date is after another date\n */\nexport function isAfter(date: Date, dateToCompare: Date): boolean {\n\treturn date.getTime() > dateToCompare.getTime();\n}\n\n/**\n * Check if date is between two dates (inclusive)\n */\nexport function isBetween(date: Date, start: Date, end: Date): boolean {\n\tconst time = date.getTime();\n\treturn time >= start.getTime() && time <= end.getTime();\n}\n\n/**\n * Get minimum date from array\n */\nexport function minDate(dates: Date[]): Date | undefined {\n\tif (dates.length === 0) return undefined;\n\treturn dates.reduce((min, date) => (date < min ? date : min));\n}\n\n/**\n * Get maximum date from array\n */\nexport function maxDate(dates: Date[]): Date | undefined {\n\tif (dates.length === 0) return undefined;\n\treturn dates.reduce((max, date) => (date > max ? date : max));\n}\n\n// ============================================================================\n// DIFFERENCE OPERATIONS\n// ============================================================================\n\n/**\n * Get difference in milliseconds\n */\nexport function differenceInMilliseconds(date1: Date, date2: Date): number {\n\treturn date1.getTime() - date2.getTime();\n}\n\n/**\n * Get difference in minutes\n */\nexport function differenceInMinutes(date1: Date, date2: Date): number {\n\treturn Math.floor(differenceInMilliseconds(date1, date2) / 60000);\n}\n\n/**\n * Get difference in hours\n */\nexport function differenceInHours(date1: Date, date2: Date): number {\n\treturn Math.floor(differenceInMilliseconds(date1, date2) / 3600000);\n}\n\n/**\n * Get difference in days\n */\nexport function differenceInDays(date1: Date, date2: Date): number {\n\tconst start = startOfDay(date1);\n\tconst end = startOfDay(date2);\n\treturn Math.floor(differenceInMilliseconds(start, end) / 86400000);\n}\n\n// ============================================================================\n// FORMATTING\n// ============================================================================\n\n/**\n * Format time as HH:MM\n */\nexport function formatTime(date: Date, format: '12h' | '24h' = '24h'): string {\n\tconst hours = date.getHours();\n\tconst minutes = date.getMinutes();\n\n\tif (format === '12h') {\n\t\tconst period = hours >= 12 ? 'PM' : 'AM';\n\t\tconst hour12 = hours % 12 || 12;\n\t\treturn `${hour12}:${minutes.toString().padStart(2, '0')} ${period}`;\n\t}\n\n\treturn `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`;\n}\n\n/**\n * Format date as YYYY-MM-DD\n */\nexport function formatDateISO(date: Date): string {\n\tconst year = date.getFullYear();\n\tconst month = (date.getMonth() + 1).toString().padStart(2, '0');\n\tconst day = date.getDate().toString().padStart(2, '0');\n\treturn `${year}-${month}-${day}`;\n}\n\n/**\n * Parse ISO date string to Date\n */\nexport function parseISO(dateString: string): Date {\n\treturn new Date(dateString);\n}\n\n// ============================================================================\n// ARRAY GENERATION\n// ============================================================================\n\n/**\n * Generate array of dates between start and end (inclusive)\n */\nexport function eachDayOfInterval(start: Date, end: Date): Date[] {\n\tconst dates: Date[] = [];\n\tlet current = startOfDay(start);\n\tconst endDay = startOfDay(end);\n\n\twhile (current <= endDay) {\n\t\tdates.push(new Date(current));\n\t\tcurrent = addDays(current, 1);\n\t}\n\n\treturn dates;\n}\n\n/**\n * Generate array of hours between start and end\n */\nexport function eachHourOfInterval(start: Date, end: Date): Date[] {\n\tconst hours: Date[] = [];\n\tlet current = new Date(start);\n\n\twhile (current <= end) {\n\t\thours.push(new Date(current));\n\t\tcurrent = addHours(current, 1);\n\t}\n\n\treturn hours;\n}\n\n/**\n * Get weekday names\n */\nexport function getWeekdayNames(\n\tlocale = 'en-US',\n\tformat: 'long' | 'short' | 'narrow' = 'short'\n): string[] {\n\tconst formatter = new Intl.DateTimeFormat(locale, { weekday: format });\n\tconst days: string[] = [];\n\n\t// Use a known Sunday to start\n\tconst baseDate = new Date(2024, 0, 7); // Sunday, Jan 7, 2024\n\n\tfor (let i = 0; i < 7; i++) {\n\t\tdays.push(formatter.format(addDays(baseDate, i)));\n\t}\n\n\treturn days;\n}\n\n/**\n * Get month names\n */\nexport function getMonthNames(\n\tlocale = 'en-US',\n\tformat: 'long' | 'short' | 'narrow' = 'long'\n): string[] {\n\tconst formatter = new Intl.DateTimeFormat(locale, { month: format });\n\tconst months: string[] = [];\n\n\tfor (let i = 0; i < 12; i++) {\n\t\tmonths.push(formatter.format(new Date(2024, i, 1)));\n\t}\n\n\treturn months;\n}\n\n// ============================================================================\n// VIEW HELPERS\n// ============================================================================\n\n/**\n * Get array of visible hours based on configuration\n */\nexport function getVisibleHoursArray(visibleHours: {\n\tstartHour: number;\n\tendHour: number;\n}): number[] {\n\tconst hours: number[] = [];\n\tfor (let h = visibleHours.startHour; h <= visibleHours.endHour; h++) {\n\t\thours.push(h);\n\t}\n\treturn hours;\n}\n\n/**\n * Format hour for display (e.g., 8 -> \"8:00\", 14 -> \"14:00\")\n */\nexport function formatHourLabel(hour: number, format: '12h' | '24h' = '24h'): string {\n\tif (format === '12h') {\n\t\tconst period = hour >= 12 ? 'PM' : 'AM';\n\t\tconst hour12 = hour % 12 || 12;\n\t\treturn `${hour12} ${period}`;\n\t}\n\t// 24h format with leading zero (e.g., \"09:00\", \"14:00\")\n\treturn `${String(hour).padStart(2, '0')}:00`;\n}\n\n/**\n * Get an array of 7 days for a week starting from the given date\n */\nexport function getWeekDays(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1): Date[] {\n\tconst weekStart = startOfWeek(date, weekStartsOn);\n\tconst days: Date[] = [];\n\n\tfor (let i = 0; i < 7; i++) {\n\t\tdays.push(addDays(weekStart, i));\n\t}\n\n\treturn days;\n}\n\n/**\n * Generate month grid cells (typically 6 weeks x 7 days = 42 days)\n * Returns enriched cell objects with date, isCurrentMonth, and isWeekend\n */\nexport function generateMonthGrid(\n\tdate: Date,\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1\n): Array<{ date: Date; isCurrentMonth: boolean; isWeekend: boolean }> {\n\tconst monthStart = startOfMonth(date);\n\tconst monthEnd = endOfMonth(date);\n\tconst gridStart = startOfWeek(monthStart, weekStartsOn);\n\tconst gridEnd = endOfWeek(monthEnd, weekStartsOn);\n\tconst currentMonth = date.getMonth();\n\n\tconst dates = eachDayOfInterval(gridStart, gridEnd);\n\n\treturn dates.map((d) => ({\n\t\tdate: d,\n\t\tisCurrentMonth: d.getMonth() === currentMonth,\n\t\tisWeekend: d.getDay() === 0 || d.getDay() === 6,\n\t}));\n}\n\n// ============================================================================\n// ALL-DAY EVENT DETECTION\n// ============================================================================\n\n/**\n * Detect whether an event should be treated as an \"all-day\" event.\n *\n * An event is all-day if:\n * 1. Its `isAllDay` flag is explicitly `true`, OR\n * 2. It starts at 00:00 and ends at 23:59 or 00:00 (next day boundary)\n *\n * All-day events should **not** display time ranges — showing \"00:00 – 23:59\"\n * is confusing for users. Instead, display \"All day\" or a date range.\n *\n * @example\n * ```ts\n * detectAllDayEvent({ startDate: new Date('2026-02-16T00:00'), endDate: new Date('2026-02-16T23:59'), isAllDay: false })\n * // => true (midnight boundaries)\n *\n * detectAllDayEvent({ startDate: new Date('2026-02-16T09:00'), endDate: new Date('2026-02-16T17:00') })\n * // => false (normal timed event)\n * ```\n */\nexport function detectAllDayEvent(event: {\n\tstartDate: Date;\n\tendDate: Date;\n\tisAllDay?: boolean;\n}): boolean {\n\t// Explicit flag takes priority — respect both true AND false\n\tif (event.isAllDay === true) return true;\n\tif (event.isAllDay === false) return false;\n\n\t// Check if times sit on day boundaries (midnight start, midnight or end-of-day end)\n\tconst startHour = event.startDate.getHours();\n\tconst startMinute = event.startDate.getMinutes();\n\tconst endHour = event.endDate.getHours();\n\tconst endMinute = event.endDate.getMinutes();\n\n\tconst startsAtMidnight = startHour === 0 && startMinute === 0;\n\tconst endsAtDayBoundary =\n\t\t(endHour === 0 && endMinute === 0) || // midnight next day\n\t\t(endHour === 23 && endMinute >= 59); // end of day (23:59 or 23:59:59)\n\n\tif (startsAtMidnight && endsAtDayBoundary) return true;\n\n\treturn false;\n}\n\n/**\n * Separate events into single-day timed events and banner events\n * (multi-day + all-day).\n *\n * All-day events (detected via {@link detectAllDayEvent}) are placed in\n * the `multiDay` bucket even when they span a single calendar day, because\n * they belong in the banner strip — not in the hourly time grid.\n */\nexport function separateEventsByDuration<\n\tTEvent extends { id: string; startDate: Date; endDate: Date; isAllDay?: boolean },\n>(\n\tevents: TEvent[]\n): {\n\tsingleDay: TEvent[];\n\tmultiDay: TEvent[];\n} {\n\tconst singleDay: TEvent[] = [];\n\tconst multiDay: TEvent[] = [];\n\n\tfor (const event of events) {\n\t\t// All-day events always go to the banner, even single-day ones\n\t\tif (detectAllDayEvent(event)) {\n\t\t\tmultiDay.push(event);\n\t\t} else if (isSameDay(event.startDate, event.endDate)) {\n\t\t\tsingleDay.push(event);\n\t\t} else {\n\t\t\tmultiDay.push(event);\n\t\t}\n\t}\n\n\treturn { singleDay, multiDay };\n}\n\n/**\n * Get events within a date range\n */\nexport function getEventsInRange<TEvent extends { startDate: Date; endDate: Date }>(\n\tevents: TEvent[],\n\trangeStart: Date,\n\trangeEnd: Date\n): TEvent[] {\n\treturn events.filter((event) => {\n\t\treturn event.startDate <= rangeEnd && event.endDate >= rangeStart;\n\t});\n}\n\n// ============================================================================\n// WORKING HOURS UTILITIES\n// ============================================================================\n\n/**\n * Check if a given hour is within working hours for a specific day\n * Handles both TWorkingHours (with `enabled`) and TWorkingHoursConfig (without `enabled`)\n */\nexport function isWorkingHour(date: Date, hour: number, workingHours?: TWorkingHours): boolean {\n\tif (!workingHours) return true; // If no working hours defined, all hours are valid\n\n\tconst dayOfWeek = date.getDay();\n\tconst dayHours = workingHours[dayOfWeek];\n\n\tif (!dayHours) return false;\n\n\t// Treat as enabled if `enabled` is undefined (backward compat with TWorkingHoursConfig)\n\tconst isEnabled = dayHours.enabled !== false;\n\tif (!isEnabled || dayHours.from === dayHours.to) {\n\t\treturn false;\n\t}\n\n\treturn hour >= dayHours.from && hour < dayHours.to;\n}\n\n/**\n * Get working hours for a specific day\n * Returns null if the day is disabled or has no working hours\n * Handles both TWorkingHours (with `enabled`) and TWorkingHoursConfig (without `enabled`)\n */\nexport function getWorkingHoursForDay(\n\tdate: Date,\n\tworkingHours: TWorkingHours\n): { from: number; to: number } | null {\n\tconst dayOfWeek = date.getDay();\n\tconst dayHours = workingHours[dayOfWeek];\n\n\tif (!dayHours) return null;\n\n\t// Treat as enabled if `enabled` is undefined (backward compat with TWorkingHoursConfig)\n\tconst isEnabled = dayHours.enabled !== false;\n\tif (!isEnabled || dayHours.from === dayHours.to) {\n\t\treturn null;\n\t}\n\n\treturn { from: dayHours.from, to: dayHours.to };\n}\n\n/**\n * Get all months for a year (for year view)\n */\nexport function getYearMonths(year: number): Date[] {\n\tconst months: Date[] = [];\n\tfor (let month = 0; month < 12; month++) {\n\t\tmonths.push(new Date(year, month, 1));\n\t}\n\treturn months;\n}\n","/**\n * Event Utilities for @inno/calendar\n *\n * Functions for filtering, sorting, and grouping events.\n * All functions are generic to work with any event data type.\n */\n\nimport type { CalendarEvent, TEventColor } from '../types';\nimport { detectAllDayEvent, endOfDay, formatTime, isSameDay, startOfDay } from './date-utils';\n\n// ============================================================================\n// FILTERING\n// ============================================================================\n\n/**\n * Filter events by date range\n */\nexport function filterEventsByDateRange<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[],\n\tstartDate: Date,\n\tendDate: Date\n): CalendarEvent<TData>[] {\n\tconst rangeStart = startOfDay(startDate);\n\tconst rangeEnd = endOfDay(endDate);\n\n\treturn events.filter((event) => {\n\t\tconst eventStart = event.startDate;\n\t\tconst eventEnd = event.endDate;\n\n\t\t// Event overlaps with range if:\n\t\t// - Event starts before range ends AND\n\t\t// - Event ends after range starts\n\t\treturn eventStart <= rangeEnd && eventEnd >= rangeStart;\n\t});\n}\n\n/**\n * Filter events by schedule type IDs\n */\nexport function filterEventsByScheduleType<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[],\n\tscheduleTypeIds: number[]\n): CalendarEvent<TData>[] {\n\tif (scheduleTypeIds.length === 0) return events;\n\treturn events.filter(\n\t\t(event) => event.scheduleTypeId !== undefined && scheduleTypeIds.includes(event.scheduleTypeId)\n\t);\n}\n\n/**\n * Filter events by resource IDs\n */\nexport function filterEventsByResource<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[],\n\tresourceIds: string[]\n): CalendarEvent<TData>[] {\n\tif (resourceIds.length === 0) return events;\n\treturn events.filter(\n\t\t(event) => event.resourceId !== undefined && resourceIds.includes(event.resourceId)\n\t);\n}\n\n/**\n * Filter events by search term\n */\nexport function filterEventsBySearch<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[],\n\tsearch: string\n): CalendarEvent<TData>[] {\n\tif (!search.trim()) return events;\n\n\tconst searchLower = search.toLowerCase();\n\treturn events.filter((event) => {\n\t\tconst titleMatch = event.title.toLowerCase().includes(searchLower);\n\t\tconst descriptionMatch = event.description?.toLowerCase().includes(searchLower);\n\t\treturn titleMatch || descriptionMatch;\n\t});\n}\n\n/**\n * Filter out canceled events\n */\nexport function filterOutCanceled<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): CalendarEvent<TData>[] {\n\treturn events.filter((event) => !event.isCanceled);\n}\n\n/**\n * Apply all filters at once\n */\nexport function applyEventFilters<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[],\n\toptions: {\n\t\tdateRange?: { startDate: Date; endDate: Date };\n\t\tscheduleTypeIds?: number[];\n\t\tresourceIds?: string[];\n\t\tsearch?: string;\n\t\tshowCanceled?: boolean;\n\t}\n): CalendarEvent<TData>[] {\n\tlet filtered = [...events];\n\n\tif (options.dateRange) {\n\t\tfiltered = filterEventsByDateRange(\n\t\t\tfiltered,\n\t\t\toptions.dateRange.startDate,\n\t\t\toptions.dateRange.endDate\n\t\t);\n\t}\n\n\tif (options.scheduleTypeIds && options.scheduleTypeIds.length > 0) {\n\t\tfiltered = filterEventsByScheduleType(filtered, options.scheduleTypeIds);\n\t}\n\n\tif (options.resourceIds && options.resourceIds.length > 0) {\n\t\tfiltered = filterEventsByResource(filtered, options.resourceIds);\n\t}\n\n\tif (options.search) {\n\t\tfiltered = filterEventsBySearch(filtered, options.search);\n\t}\n\n\tif (!options.showCanceled) {\n\t\tfiltered = filterOutCanceled(filtered);\n\t}\n\n\treturn filtered;\n}\n\n// ============================================================================\n// SORTING\n// ============================================================================\n\n/**\n * Sort events by start date (ascending)\n */\nexport function sortEventsByStart<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): CalendarEvent<TData>[] {\n\treturn [...events].sort((a, b) => a.startDate.getTime() - b.startDate.getTime());\n}\n\n/**\n * Sort events by end date (ascending)\n */\nexport function sortEventsByEnd<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): CalendarEvent<TData>[] {\n\treturn [...events].sort((a, b) => a.endDate.getTime() - b.endDate.getTime());\n}\n\n/**\n * Sort events by duration (longest first)\n */\nexport function sortEventsByDuration<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): CalendarEvent<TData>[] {\n\treturn [...events].sort((a, b) => {\n\t\tconst durationA = a.endDate.getTime() - a.startDate.getTime();\n\t\tconst durationB = b.endDate.getTime() - b.startDate.getTime();\n\t\treturn durationB - durationA;\n\t});\n}\n\n// ============================================================================\n// GROUPING\n// ============================================================================\n\n/**\n * Group events by date\n */\nexport function groupEventsByDate<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): Map<string, CalendarEvent<TData>[]> {\n\tconst groups = new Map<string, CalendarEvent<TData>[]>();\n\n\tfor (const event of events) {\n\t\tconst dateKey = startOfDay(event.startDate).toISOString();\n\t\tconst existing = groups.get(dateKey) ?? [];\n\t\texisting.push(event);\n\t\tgroups.set(dateKey, existing);\n\t}\n\n\treturn groups;\n}\n\n/**\n * Group events by schedule type\n */\nexport function groupEventsByScheduleType<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): Map<number | undefined, CalendarEvent<TData>[]> {\n\tconst groups = new Map<number | undefined, CalendarEvent<TData>[]>();\n\n\tfor (const event of events) {\n\t\tconst existing = groups.get(event.scheduleTypeId) ?? [];\n\t\texisting.push(event);\n\t\tgroups.set(event.scheduleTypeId, existing);\n\t}\n\n\treturn groups;\n}\n\n/**\n * Group events by resource\n */\nexport function groupEventsByResource<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): Map<string | undefined, CalendarEvent<TData>[]> {\n\tconst groups = new Map<string | undefined, CalendarEvent<TData>[]>();\n\n\tfor (const event of events) {\n\t\tconst existing = groups.get(event.resourceId) ?? [];\n\t\texisting.push(event);\n\t\tgroups.set(event.resourceId, existing);\n\t}\n\n\treturn groups;\n}\n\n// ============================================================================\n// QUERIES\n// ============================================================================\n\n/**\n * Get events for a specific day\n */\nexport function getEventsForDay<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[],\n\tdate: Date\n): CalendarEvent<TData>[] {\n\treturn events.filter((event) => {\n\t\t// Check if event spans this day\n\t\tconst dayStart = startOfDay(date);\n\t\tconst dayEnd = endOfDay(date);\n\t\treturn event.startDate <= dayEnd && event.endDate >= dayStart;\n\t});\n}\n\n/**\n * Get all-day events\n */\nexport function getAllDayEvents<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): CalendarEvent<TData>[] {\n\treturn events.filter((event) => event.isAllDay);\n}\n\n/**\n * Get timed events (not all-day)\n */\nexport function getTimedEvents<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): CalendarEvent<TData>[] {\n\treturn events.filter((event) => !event.isAllDay);\n}\n\n/**\n * Get multi-day events\n */\nexport function getMultiDayEvents<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): CalendarEvent<TData>[] {\n\treturn events.filter((event) => {\n\t\tif (event.isMultiDay) return true;\n\t\treturn !isSameDay(event.startDate, event.endDate);\n\t});\n}\n\n/**\n * Check if event spans multiple days\n */\nexport function isMultiDayEvent<TData = Record<string, unknown>>(\n\tevent: CalendarEvent<TData>\n): boolean {\n\tif (event.isMultiDay) return true;\n\treturn !isSameDay(event.startDate, event.endDate);\n}\n\n/**\n * Get event duration in minutes\n */\nexport function getEventDurationMinutes<TData = Record<string, unknown>>(\n\tevent: CalendarEvent<TData>\n): number {\n\treturn Math.floor((event.endDate.getTime() - event.startDate.getTime()) / 60000);\n}\n\n// ============================================================================\n// COLOR UTILITIES\n// ============================================================================\n\n/**\n * Get event color with fallback\n */\nexport function getEventColor<TData = Record<string, unknown>>(\n\tevent: CalendarEvent<TData>,\n\tdefaultColor: TEventColor = 'blue'\n): TEventColor {\n\treturn event.color ?? defaultColor;\n}\n\n/**\n * Resolve color from schedule type or event\n */\nexport function resolveEventColor<TData = Record<string, unknown>>(\n\tevent: CalendarEvent<TData>,\n\tscheduleTypeColors?: Map<number, TEventColor | string>,\n\tdefaultColor: TEventColor = 'blue'\n): TEventColor | string {\n\t// Event color takes precedence\n\tif (event.color) return event.color;\n\n\t// Then schedule type color\n\tif (event.scheduleTypeId !== undefined && scheduleTypeColors) {\n\t\tconst typeColor = scheduleTypeColors.get(event.scheduleTypeId);\n\t\tif (typeColor) return typeColor;\n\t}\n\n\treturn defaultColor;\n}\n\n// ============================================================================\n// ALL-DAY / TIME DISPLAY\n// ============================================================================\n\n/**\n * Format event time display intelligently based on event type.\n *\n * - **All-day events** → `\"All day\"` (no confusing \"00:00 – 23:59\")\n * - **Multi-day all-day** → `\"All day · Feb 16 – Feb 18\"`\n * - **Multi-day timed** → `\"Feb 16, 09:00 – Feb 18, 17:00\"`\n * - **Regular events** → `\"09:00 – 17:00\"`\n *\n * @example\n * ```ts\n * formatEventTimeDisplay({ startDate: allDayStart, endDate: allDayEnd, isAllDay: true });\n * // => \"All day\"\n *\n * formatEventTimeDisplay({ startDate: normalStart, endDate: normalEnd });\n * // => \"09:00 - 17:00\"\n * ```\n */\nexport function formatEventTimeDisplay(event: {\n\tstartDate: Date;\n\tendDate: Date;\n\tisAllDay?: boolean;\n\tisMultiDay?: boolean;\n}): string {\n\tconst isAllDay = detectAllDayEvent(event);\n\n\tif (isAllDay) {\n\t\tif (isSameDay(event.startDate, event.endDate)) {\n\t\t\treturn 'All day';\n\t\t}\n\t\t// Multi-day all-day: \"All day · Feb 16 – Feb 18\"\n\t\tconst startStr = event.startDate.toLocaleDateString(undefined, {\n\t\t\tmonth: 'short',\n\t\t\tday: 'numeric',\n\t\t});\n\t\tconst endStr = event.endDate.toLocaleDateString(undefined, {\n\t\t\tmonth: 'short',\n\t\t\tday: 'numeric',\n\t\t});\n\t\treturn `All day · ${startStr} – ${endStr}`;\n\t}\n\n\t// Multi-day timed (not all-day): \"Feb 16, 09:00 – Feb 18, 17:00\"\n\tif (!isSameDay(event.startDate, event.endDate)) {\n\t\tconst startDateStr = event.startDate.toLocaleDateString(undefined, {\n\t\t\tmonth: 'short',\n\t\t\tday: 'numeric',\n\t\t});\n\t\tconst endDateStr = event.endDate.toLocaleDateString(undefined, {\n\t\t\tmonth: 'short',\n\t\t\tday: 'numeric',\n\t\t});\n\t\treturn `${startDateStr}, ${formatTime(event.startDate)} – ${endDateStr}, ${formatTime(event.endDate)}`;\n\t}\n\n\t// Regular single-day timed event: \"09:00 - 17:00\"\n\treturn `${formatTime(event.startDate)} - ${formatTime(event.endDate)}`;\n}\n\n/**\n * Check whether an event should display its time range.\n *\n * Returns `false` for all-day events (where times like \"00:00 – 23:59\"\n * would be meaningless and confusing to users).\n *\n * @example\n * ```ts\n * shouldShowEventTime({ isAllDay: true, startDate, endDate }); // false\n * shouldShowEventTime({ startDate: new Date('2026-02-16T09:00'), endDate: new Date('2026-02-16T17:00') }); // true\n * ```\n */\nexport function shouldShowEventTime(event: {\n\tstartDate: Date;\n\tendDate: Date;\n\tisAllDay?: boolean;\n}): boolean {\n\treturn !detectAllDayEvent(event);\n}\n","/**\n * Grid Utilities for @inno/calendar\n *\n * Functions for view navigation, date ranges, and cell generation.\n */\n\nimport type { ICalendarCell, IDateRange, TCalendarView } from '../types';\nimport {\n\taddDays,\n\taddMonths,\n\taddWeeks,\n\taddYears,\n\tendOfDay,\n\tendOfMonth,\n\tendOfWeek,\n\tendOfYear,\n\tisSameMonth,\n\tisToday,\n\tisWeekend,\n\tstartOfDay,\n\tstartOfMonth,\n\tstartOfWeek,\n\tstartOfYear,\n} from './date-utils';\n\n// ============================================================================\n// VIEW DATE RANGES\n// ============================================================================\n\n/**\n * Get date range for a specific view\n */\nexport function getViewDateRange(\n\tdate: Date,\n\tview: TCalendarView,\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1\n): IDateRange {\n\tswitch (view) {\n\t\tcase 'day':\n\t\tcase 'resource-day':\n\t\tcase 'timeline-day':\n\t\t\treturn {\n\t\t\t\tstartDate: startOfDay(date),\n\t\t\t\tendDate: endOfDay(date),\n\t\t\t};\n\n\t\tcase 'week':\n\t\tcase 'resource-week':\n\t\tcase 'timeline-week':\n\t\t\treturn {\n\t\t\t\tstartDate: startOfWeek(date, weekStartsOn),\n\t\t\t\tendDate: endOfWeek(date, weekStartsOn),\n\t\t\t};\n\n\t\tcase 'month': {\n\t\t\t// Include partial weeks at start and end\n\t\t\tconst monthStart = startOfMonth(date);\n\t\t\tconst monthEnd = endOfMonth(date);\n\t\t\treturn {\n\t\t\t\tstartDate: startOfWeek(monthStart, weekStartsOn),\n\t\t\t\tendDate: endOfWeek(monthEnd, weekStartsOn),\n\t\t\t};\n\t\t}\n\n\t\tcase 'timeline-3day':\n\t\t\treturn {\n\t\t\t\tstartDate: startOfDay(date),\n\t\t\t\tendDate: endOfDay(addDays(date, 2)),\n\t\t\t};\n\n\t\tcase 'year':\n\t\t\treturn {\n\t\t\t\tstartDate: startOfYear(date),\n\t\t\t\tendDate: endOfYear(date),\n\t\t\t};\n\n\t\tcase 'agenda':\n\t\t\t// Agenda typically shows next 30 days\n\t\t\treturn {\n\t\t\t\tstartDate: startOfDay(date),\n\t\t\t\tendDate: endOfDay(addDays(date, 29)),\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tstartDate: startOfDay(date),\n\t\t\t\tendDate: endOfDay(date),\n\t\t\t};\n\t}\n}\n\n// ============================================================================\n// NAVIGATION\n// ============================================================================\n\n/**\n * Navigate to next period based on view\n */\nexport function navigateNext(date: Date, view: TCalendarView): Date {\n\tswitch (view) {\n\t\tcase 'day':\n\t\tcase 'resource-day':\n\t\tcase 'timeline-day':\n\t\t\treturn addDays(date, 1);\n\n\t\tcase 'timeline-3day':\n\t\t\treturn addDays(date, 3);\n\n\t\tcase 'week':\n\t\tcase 'resource-week':\n\t\tcase 'timeline-week':\n\t\t\treturn addWeeks(date, 1);\n\n\t\tcase 'month':\n\t\t\treturn addMonths(date, 1);\n\n\t\tcase 'year':\n\t\t\treturn addYears(date, 1);\n\n\t\tcase 'agenda':\n\t\t\treturn addWeeks(date, 1);\n\n\t\tdefault:\n\t\t\treturn addDays(date, 1);\n\t}\n}\n\n/**\n * Navigate to previous period based on view\n */\nexport function navigatePrev(date: Date, view: TCalendarView): Date {\n\tswitch (view) {\n\t\tcase 'day':\n\t\tcase 'resource-day':\n\t\tcase 'timeline-day':\n\t\t\treturn addDays(date, -1);\n\n\t\tcase 'timeline-3day':\n\t\t\treturn addDays(date, -3);\n\n\t\tcase 'week':\n\t\tcase 'resource-week':\n\t\tcase 'timeline-week':\n\t\t\treturn addWeeks(date, -1);\n\n\t\tcase 'month':\n\t\t\treturn addMonths(date, -1);\n\n\t\tcase 'year':\n\t\t\treturn addYears(date, -1);\n\n\t\tcase 'agenda':\n\t\t\treturn addWeeks(date, -1);\n\n\t\tdefault:\n\t\t\treturn addDays(date, -1);\n\t}\n}\n\n/**\n * Navigate to today\n */\nexport function navigateToday(): Date {\n\treturn startOfDay(new Date());\n}\n\n// ============================================================================\n// CELL GENERATION\n// ============================================================================\n\n/**\n * Generate cells for month view\n */\nexport function generateMonthCells(\n\tdate: Date,\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1\n): ICalendarCell[] {\n\tconst monthStart = startOfMonth(date);\n\tconst monthEnd = endOfMonth(date);\n\tconst viewStart = startOfWeek(monthStart, weekStartsOn);\n\tconst viewEnd = endOfWeek(monthEnd, weekStartsOn);\n\n\tconst cells: ICalendarCell[] = [];\n\tlet current = viewStart;\n\n\twhile (current <= viewEnd) {\n\t\tcells.push({\n\t\t\tdate: new Date(current),\n\t\t\tisToday: isToday(current),\n\t\t\tisCurrentMonth: isSameMonth(current, date),\n\t\t\tisWeekend: isWeekend(current),\n\t\t\tdayOfWeek: current.getDay(),\n\t\t});\n\t\tcurrent = addDays(current, 1);\n\t}\n\n\treturn cells;\n}\n\n/**\n * Generate cells for week view\n */\nexport function generateWeekCells(\n\tdate: Date,\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1\n): ICalendarCell[] {\n\tconst weekStart = startOfWeek(date, weekStartsOn);\n\tconst cells: ICalendarCell[] = [];\n\n\tfor (let i = 0; i < 7; i++) {\n\t\tconst current = addDays(weekStart, i);\n\t\tcells.push({\n\t\t\tdate: current,\n\t\t\tisToday: isToday(current),\n\t\t\tisCurrentMonth: isSameMonth(current, date),\n\t\t\tisWeekend: isWeekend(current),\n\t\t\tdayOfWeek: current.getDay(),\n\t\t});\n\t}\n\n\treturn cells;\n}\n\n/**\n * Generate cells for year view (months)\n */\nexport function generateYearCells(date: Date): ICalendarCell[] {\n\tconst yearStart = startOfYear(date);\n\tconst cells: ICalendarCell[] = [];\n\n\tfor (let i = 0; i < 12; i++) {\n\t\tconst current = addMonths(yearStart, i);\n\t\tcells.push({\n\t\t\tdate: current,\n\t\t\tisToday: isSameMonth(current, new Date()),\n\t\t\tisCurrentMonth: true,\n\t\t\tisWeekend: false,\n\t\t\tdayOfWeek: current.getDay(),\n\t\t});\n\t}\n\n\treturn cells;\n}\n\n// ============================================================================\n// TIME SLOTS\n// ============================================================================\n\n/**\n * Generate time slots for a day\n */\nexport function generateTimeSlots(\n\tstartHour: number,\n\tendHour: number,\n\tslotDuration: number = 30\n): { hour: number; minute: number; label: string }[] {\n\tconst slots: { hour: number; minute: number; label: string }[] = [];\n\tconst slotsPerHour = 60 / slotDuration;\n\n\tfor (let hour = startHour; hour < endHour; hour++) {\n\t\tfor (let slot = 0; slot < slotsPerHour; slot++) {\n\t\t\tconst minute = slot * slotDuration;\n\t\t\tslots.push({\n\t\t\t\thour,\n\t\t\t\tminute,\n\t\t\t\tlabel: `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn slots;\n}\n\n/**\n * Generate hour labels\n */\nexport function generateHourLabels(\n\tstartHour: number,\n\tendHour: number,\n\tformat: '12h' | '24h' = '24h'\n): { hour: number; label: string }[] {\n\tconst labels: { hour: number; label: string }[] = [];\n\n\tfor (let hour = startHour; hour <= endHour; hour++) {\n\t\tlet label: string;\n\t\tif (format === '12h') {\n\t\t\tconst period = hour >= 12 ? 'PM' : 'AM';\n\t\t\tconst hour12 = hour % 12 || 12;\n\t\t\tlabel = `${hour12} ${period}`;\n\t\t} else {\n\t\t\tlabel = `${hour.toString().padStart(2, '0')}:00`;\n\t\t}\n\t\tlabels.push({ hour, label });\n\t}\n\n\treturn labels;\n}\n\n// ============================================================================\n// VIEW TITLE\n// ============================================================================\n\n/**\n * Get range text for date navigator (e.g., \"Mon, Jan 1 - Sun, Jan 7\")\n * Shows a more compact range description below the month/year title\n */\nexport function getRangeText(date: Date, view: TCalendarView, locale = 'en-US'): string {\n\tconst dayMonthFormat = new Intl.DateTimeFormat(locale, {\n\t\tweekday: 'short',\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t});\n\tconst shortFormat = new Intl.DateTimeFormat(locale, { month: 'short', day: 'numeric' });\n\n\tswitch (view) {\n\t\tcase 'day':\n\t\tcase 'resource-day':\n\t\tcase 'timeline-day':\n\t\t\treturn dayMonthFormat.format(date);\n\n\t\tcase 'timeline-3day': {\n\t\t\tconst start3 = startOfDay(date);\n\t\t\tconst end3 = addDays(date, 2);\n\t\t\treturn `${shortFormat.format(start3)} - ${shortFormat.format(end3)}`;\n\t\t}\n\n\t\tcase 'week':\n\t\tcase 'resource-week':\n\t\tcase 'timeline-week': {\n\t\t\tconst weekStart = startOfWeek(date, 1);\n\t\t\tconst weekEnd = endOfWeek(date, 1);\n\t\t\treturn `${shortFormat.format(weekStart)} - ${shortFormat.format(weekEnd)}`;\n\t\t}\n\n\t\tcase 'month': {\n\t\t\tconst monthStart = startOfMonth(date);\n\t\t\tconst monthEnd = endOfMonth(date);\n\t\t\treturn `${shortFormat.format(monthStart)} - ${shortFormat.format(monthEnd)}`;\n\t\t}\n\n\t\tcase 'year':\n\t\t\treturn `Jan 1 - Dec 31, ${date.getFullYear()}`;\n\n\t\tcase 'agenda': {\n\t\t\tconst monthStart = startOfMonth(date);\n\t\t\tconst monthEnd = endOfMonth(date);\n\t\t\treturn `${shortFormat.format(monthStart)} - ${shortFormat.format(monthEnd)}`;\n\t\t}\n\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\n/**\n * Count events in the current view's date range\n * Useful for showing an event count badge in the navigation\n */\nexport function getEventsCountInView(\n\tevents: { startDate: Date; endDate: Date }[],\n\tdate: Date,\n\tview: TCalendarView,\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1\n): number {\n\tconst range = getViewDateRange(date, view, weekStartsOn);\n\n\treturn events.filter((event) => {\n\t\t// Event overlaps with period if it starts before period ends AND ends after period starts\n\t\treturn event.startDate <= range.endDate && event.endDate >= range.startDate;\n\t}).length;\n}\n\n/**\n * Get formatted title for current view\n */\nexport function getViewTitle(date: Date, view: TCalendarView, locale = 'en-US'): string {\n\tconst monthFormat = new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' });\n\tconst dateFormat = new Intl.DateTimeFormat(locale, {\n\t\tweekday: 'long',\n\t\tmonth: 'long',\n\t\tday: 'numeric',\n\t\tyear: 'numeric',\n\t});\n\n\tswitch (view) {\n\t\tcase 'day':\n\t\tcase 'resource-day':\n\t\tcase 'timeline-day':\n\t\t\treturn dateFormat.format(date);\n\n\t\tcase 'week':\n\t\tcase 'resource-week':\n\t\tcase 'timeline-week': {\n\t\t\tconst weekStart = startOfWeek(date, 1);\n\t\t\tconst weekEnd = endOfWeek(date, 1);\n\t\t\tconst startMonth = new Intl.DateTimeFormat(locale, { month: 'short' }).format(weekStart);\n\t\t\tconst endMonth = new Intl.DateTimeFormat(locale, { month: 'short' }).format(weekEnd);\n\t\t\tconst year = weekStart.getFullYear();\n\n\t\t\tif (startMonth === endMonth) {\n\t\t\t\treturn `${startMonth} ${weekStart.getDate()} - ${weekEnd.getDate()}, ${year}`;\n\t\t\t}\n\t\t\treturn `${startMonth} ${weekStart.getDate()} - ${endMonth} ${weekEnd.getDate()}, ${year}`;\n\t\t}\n\n\t\tcase 'month':\n\t\t\treturn monthFormat.format(date);\n\n\t\tcase 'year':\n\t\t\treturn date.getFullYear().toString();\n\n\t\tcase 'agenda':\n\t\t\treturn `Agenda - ${monthFormat.format(date)}`;\n\n\t\tdefault:\n\t\t\treturn monthFormat.format(date);\n\t}\n}\n\n// ============================================================================\n// WEEK DAYS\n// ============================================================================\n\n/**\n * Get weekday headers for week/month views\n */\nexport function getWeekdayHeaders(\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n\tformat: 'long' | 'short' | 'narrow' = 'short',\n\tlocale = 'en-US'\n): { dayOfWeek: number; label: string }[] {\n\tconst formatter = new Intl.DateTimeFormat(locale, { weekday: format });\n\tconst headers: { dayOfWeek: number; label: string }[] = [];\n\n\t// Start from a known date (Jan 7, 2024 is a Sunday)\n\tconst baseDate = new Date(2024, 0, 7);\n\n\tfor (let i = 0; i < 7; i++) {\n\t\tconst dayIndex = (weekStartsOn + i) % 7;\n\t\tconst date = addDays(baseDate, dayIndex);\n\t\theaders.push({\n\t\t\tdayOfWeek: dayIndex,\n\t\t\tlabel: formatter.format(date),\n\t\t});\n\t}\n\n\treturn headers;\n}\n","/**\n * Position Utilities for @inno/calendar\n *\n * Functions for calculating event positions in time grid views.\n */\n\nimport { DEFAULT_HOUR_HEIGHT, MIN_EVENT_HEIGHT } from '../constants';\nimport type { CalendarEvent, IEventPosition, IPositionedEvent, IVisibleHours } from '../types';\n\n// ============================================================================\n// POSITION CALCULATION\n// ============================================================================\n\n/**\n * Calculate event position in time grid\n */\nexport function calculateEventPosition<TData = Record<string, unknown>>(\n\tevent: CalendarEvent<TData>,\n\t_dayStart: Date,\n\tvisibleHours: IVisibleHours,\n\thourHeight: number = DEFAULT_HOUR_HEIGHT\n): IEventPosition {\n\tconst { startHour, endHour } = visibleHours;\n\tconst totalVisibleHours = endHour - startHour;\n\tconst totalHeight = totalVisibleHours * hourHeight;\n\n\t// Get event times as decimal hours\n\tconst eventStartHour = event.startDate.getHours() + event.startDate.getMinutes() / 60;\n\tconst eventEndHour = event.endDate.getHours() + event.endDate.getMinutes() / 60;\n\n\t// Clamp to visible range\n\tconst clampedStart = Math.max(eventStartHour, startHour);\n\tconst clampedEnd = Math.min(eventEndHour, endHour);\n\n\t// Calculate position relative to visible area\n\tconst top = ((clampedStart - startHour) / totalVisibleHours) * totalHeight;\n\tconst bottom = ((clampedEnd - startHour) / totalVisibleHours) * totalHeight;\n\tconst height = Math.max(bottom - top, MIN_EVENT_HEIGHT);\n\n\treturn {\n\t\ttop,\n\t\theight,\n\t\tleft: 0,\n\t\twidth: 100,\n\t\tzIndex: 1,\n\t};\n}\n\n/**\n * Calculate positions for overlapping events using group-based columns.\n *\n * Events are first grouped into overlap clusters. Within each cluster,\n * columns are assigned independently so that non-overlapping events can\n * expand to full width instead of being constrained by unrelated events.\n */\nexport function calculateOverlappingPositions<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[],\n\tdayStart: Date,\n\tvisibleHours: IVisibleHours,\n\thourHeight: number = DEFAULT_HOUR_HEIGHT\n): IPositionedEvent<TData>[] {\n\tif (events.length === 0) return [];\n\n\t// Sort by start time, then by duration (longer events first)\n\tconst sortedEvents = [...events].sort((a, b) => {\n\t\tconst startDiff = a.startDate.getTime() - b.startDate.getTime();\n\t\tif (startDiff !== 0) return startDiff;\n\t\tconst durationA = a.endDate.getTime() - a.startDate.getTime();\n\t\tconst durationB = b.endDate.getTime() - b.startDate.getTime();\n\t\treturn durationB - durationA;\n\t});\n\n\t// --- Step 1: Group events into overlap clusters ---\n\tconst groups: CalendarEvent<TData>[][] = [];\n\tlet currentGroup: CalendarEvent<TData>[] = [];\n\tlet groupEnd = 0;\n\n\tfor (const event of sortedEvents) {\n\t\tif (currentGroup.length === 0 || event.startDate.getTime() < groupEnd) {\n\t\t\tcurrentGroup.push(event);\n\t\t\tgroupEnd = Math.max(groupEnd, event.endDate.getTime());\n\t\t} else {\n\t\t\tgroups.push(currentGroup);\n\t\t\tcurrentGroup = [event];\n\t\t\tgroupEnd = event.endDate.getTime();\n\t\t}\n\t}\n\tif (currentGroup.length > 0) {\n\t\tgroups.push(currentGroup);\n\t}\n\n\t// --- Step 2: Assign columns within each group independently ---\n\tconst positionedEvents: IPositionedEvent<TData>[] = [];\n\n\tfor (const group of groups) {\n\t\tconst columns: { event: CalendarEvent<TData>; endTime: number }[][] = [];\n\n\t\tfor (const event of group) {\n\t\t\tconst eventStart = event.startDate.getTime();\n\t\t\tconst eventEnd = event.endDate.getTime();\n\n\t\t\t// Find first available column within this group\n\t\t\tlet columnIndex = -1;\n\t\t\tfor (let i = 0; i < columns.length; i++) {\n\t\t\t\tconst column = columns[i];\n\t\t\t\tif (!column) continue;\n\t\t\t\tconst lastInColumn = column[column.length - 1];\n\t\t\t\tif (lastInColumn && lastInColumn.endTime <= eventStart) {\n\t\t\t\t\tcolumnIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (columnIndex === -1) {\n\t\t\t\tcolumnIndex = columns.length;\n\t\t\t\tcolumns.push([]);\n\t\t\t}\n\n\t\t\tconst column = columns[columnIndex];\n\t\t\tif (column) {\n\t\t\t\tcolumn.push({ event, endTime: eventEnd });\n\t\t\t}\n\n\t\t\tconst basePosition = calculateEventPosition<TData>(event, dayStart, visibleHours, hourHeight);\n\n\t\t\tpositionedEvents.push({\n\t\t\t\tevent,\n\t\t\t\tposition: basePosition,\n\t\t\t\tcolumn: columnIndex,\n\t\t\t\tcolumnSpan: 1,\n\t\t\t});\n\t\t}\n\n\t\t// Calculate width and left using this group's column count\n\t\tconst totalColumns = columns.length;\n\t\tconst widthPerColumn = 100 / totalColumns;\n\n\t\t// Only update positions for events in this group\n\t\tconst groupIds = new Set(group.map((e) => e.id));\n\t\tfor (const positioned of positionedEvents) {\n\t\t\tif (!groupIds.has(positioned.event.id)) continue;\n\t\t\tpositioned.position.left = positioned.column * widthPerColumn;\n\t\t\tpositioned.position.width = widthPerColumn * positioned.columnSpan;\n\t\t\tpositioned.position.zIndex = positioned.column + 1;\n\t\t}\n\t}\n\n\treturn positionedEvents;\n}\n\n// ============================================================================\n// TIME TO POSITION CONVERSION\n// ============================================================================\n\n/**\n * Convert Y position to time\n */\nexport function yToTime(\n\ty: number,\n\tdayStart: Date,\n\tvisibleHours: IVisibleHours,\n\thourHeight: number = DEFAULT_HOUR_HEIGHT,\n\tslotDuration: number = 30\n): Date {\n\tconst { startHour, endHour } = visibleHours;\n\tconst totalVisibleHours = endHour - startHour;\n\tconst totalHeight = totalVisibleHours * hourHeight;\n\n\t// Calculate hours from top\n\tconst hoursFromTop = (y / totalHeight) * totalVisibleHours;\n\tconst absoluteHours = startHour + hoursFromTop;\n\n\t// Snap to slot duration\n\tconst totalMinutes = absoluteHours * 60;\n\tconst snappedMinutes = Math.round(totalMinutes / slotDuration) * slotDuration;\n\n\t// Create date with snapped time\n\tconst result = new Date(dayStart);\n\tresult.setHours(0, 0, 0, 0);\n\tresult.setMinutes(snappedMinutes);\n\n\treturn result;\n}\n\n/**\n * Convert time to Y position\n */\nexport function timeToY(\n\ttime: Date,\n\tvisibleHours: IVisibleHours,\n\thourHeight: number = DEFAULT_HOUR_HEIGHT\n): number {\n\tconst { startHour, endHour } = visibleHours;\n\tconst totalVisibleHours = endHour - startHour;\n\tconst totalHeight = totalVisibleHours * hourHeight;\n\n\tconst hours = time.getHours() + time.getMinutes() / 60;\n\tconst clampedHours = Math.max(startHour, Math.min(hours, endHour));\n\n\treturn ((clampedHours - startHour) / totalVisibleHours) * totalHeight;\n}\n\n// ============================================================================\n// OVERLAP DETECTION\n// ============================================================================\n\n/**\n * Check if two events overlap in time\n */\nexport function eventsOverlap(event1: CalendarEvent, event2: CalendarEvent): boolean {\n\treturn event1.startDate < event2.endDate && event1.endDate > event2.startDate;\n}\n\n/**\n * Get overlapping event groups\n */\nexport function getOverlappingGroups<TData = Record<string, unknown>>(\n\tevents: CalendarEvent<TData>[]\n): CalendarEvent<TData>[][] {\n\tif (events.length === 0) return [];\n\n\tconst sorted = [...events].sort((a, b) => a.startDate.getTime() - b.startDate.getTime());\n\tconst groups: CalendarEvent<TData>[][] = [];\n\tlet currentGroup: CalendarEvent<TData>[] = [];\n\tlet groupEnd = 0;\n\n\tfor (const event of sorted) {\n\t\tif (currentGroup.length === 0 || event.startDate.getTime() < groupEnd) {\n\t\t\t// Event overlaps with current group\n\t\t\tcurrentGroup.push(event);\n\t\t\tgroupEnd = Math.max(groupEnd, event.endDate.getTime());\n\t\t} else {\n\t\t\t// Start new group\n\t\t\tif (currentGroup.length > 0) {\n\t\t\t\tgroups.push(currentGroup);\n\t\t\t}\n\t\t\tcurrentGroup = [event];\n\t\t\tgroupEnd = event.endDate.getTime();\n\t\t}\n\t}\n\n\tif (currentGroup.length > 0) {\n\t\tgroups.push(currentGroup);\n\t}\n\n\treturn groups;\n}\n\n// ============================================================================\n// SELECTION OVERLAY\n// ============================================================================\n\n/**\n * Calculate selection overlay dimensions\n */\nexport function calculateSelectionOverlay(\n\tstartY: number,\n\tcurrentY: number,\n\tcontainerHeight: number\n): { top: number; height: number } {\n\tconst minY = Math.max(0, Math.min(startY, currentY));\n\tconst maxY = Math.min(containerHeight, Math.max(startY, currentY));\n\n\treturn {\n\t\ttop: minY,\n\t\theight: maxY - minY,\n\t};\n}\n"],"names":["CALENDAR_VIEWS","DEFAULT_PREFERENCES","DEFAULT_VISIBLE_HOURS","DEFAULT_BUSINESS_HOURS","DEFAULT_VIEW_CONFIGS","EVENT_COLORS","EVENT_COLOR_CLASSES","HEX_TO_EVENT_COLOR","HOURS_IN_DAY","MINUTES_IN_HOUR","MS_PER_MINUTE","MS_PER_HOUR","MS_PER_DAY","DEFAULT_HOUR_HEIGHT","DEFAULT_SLOT_HEIGHT","DEFAULT_HEADER_HEIGHT","DEFAULT_RESOURCE_WIDTH","MIN_EVENT_HEIGHT","startOfDay","date","result","endOfDay","addDays","days","subDays","isSameDay","date1","date2","isToday","getDayOfWeek","isWeekend","day","startOfWeek","weekStartsOn","diff","endOfWeek","addWeeks","weeks","subWeeks","getWeekNumber","d","dayNum","yearStart","isSameWeek","start1","start2","startOfMonth","endOfMonth","addMonths","months","subMonths","getDaysInMonth","isSameMonth","startOfYear","endOfYear","addYears","years","subYears","isSameYear","addHours","hours","addMinutes","minutes","setTime","seconds","getDecimalHours","isBefore","dateToCompare","isAfter","isBetween","start","end","time","minDate","dates","min","maxDate","max","differenceInMilliseconds","differenceInMinutes","differenceInHours","differenceInDays","formatTime","format","period","formatDateISO","year","month","parseISO","dateString","eachDayOfInterval","current","endDay","eachHourOfInterval","getWeekdayNames","locale","formatter","baseDate","i","getMonthNames","getVisibleHoursArray","visibleHours","h","formatHourLabel","hour","getWeekDays","weekStart","generateMonthGrid","monthStart","monthEnd","gridStart","gridEnd","currentMonth","detectAllDayEvent","event","startHour","startMinute","endHour","endMinute","startsAtMidnight","endsAtDayBoundary","separateEventsByDuration","events","singleDay","multiDay","getEventsInRange","rangeStart","rangeEnd","isWorkingHour","workingHours","dayOfWeek","dayHours","getWorkingHoursForDay","getYearMonths","filterEventsByDateRange","startDate","endDate","eventStart","eventEnd","filterEventsByScheduleType","scheduleTypeIds","filterEventsByResource","resourceIds","filterEventsBySearch","search","searchLower","titleMatch","descriptionMatch","filterOutCanceled","applyEventFilters","options","filtered","sortEventsByStart","a","b","sortEventsByEnd","sortEventsByDuration","durationA","groupEventsByDate","groups","dateKey","existing","groupEventsByScheduleType","groupEventsByResource","getEventsForDay","dayStart","dayEnd","getAllDayEvents","getTimedEvents","getMultiDayEvents","isMultiDayEvent","getEventDurationMinutes","getEventColor","defaultColor","resolveEventColor","scheduleTypeColors","typeColor","formatEventTimeDisplay","startStr","endStr","startDateStr","endDateStr","shouldShowEventTime","getViewDateRange","view","navigateNext","navigatePrev","navigateToday","generateMonthCells","viewStart","viewEnd","cells","generateWeekCells","generateYearCells","generateTimeSlots","slotDuration","slots","slotsPerHour","slot","minute","generateHourLabels","labels","label","getRangeText","dayMonthFormat","shortFormat","start3","end3","weekEnd","getEventsCountInView","range","getViewTitle","monthFormat","dateFormat","startMonth","endMonth","getWeekdayHeaders","headers","dayIndex","calculateEventPosition","_dayStart","hourHeight","totalVisibleHours","totalHeight","eventStartHour","eventEndHour","clampedStart","clampedEnd","top","bottom","height","calculateOverlappingPositions","sortedEvents","startDiff","currentGroup","groupEnd","positionedEvents","group","columns","columnIndex","column","lastInColumn","basePosition","widthPerColumn","groupIds","e","positioned","yToTime","y","hoursFromTop","totalMinutes","snappedMinutes","timeToY","eventsOverlap","event1","event2","getOverlappingGroups","sorted","calculateSelectionOverlay","startY","currentY","containerHeight","minY","maxY"],"mappings":"AAqBO,MAAMA,KAAkC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GASaC,KAA4C;AAAA,EACxD,WAAW;AAAA,EACX,SAAS;AAAA,EACT,gBAAgB;AAAA;AAAA,EAChB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,oBAAoB;AACrB,GAKaC,KAAuC;AAAA,EACnD,WAAW;AAAA,EACX,SAAS;AACV,GAKaC,KAAwC;AAAA,EACpD,WAAW;AAAA,EACX,SAAS;AACV,GASaC,KAA2D;AAAA,EACvE,KAAK;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,YAAY;AAAA,EAAA;AAAA,EAEb,MAAM;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB,YAAY;AAAA,EAAA;AAAA,EAEb,OAAO;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,YAAY;AAAA,EAAA;AAAA,EAEb,MAAM;AAAA,IACL,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,YAAY;AAAA,EAAA;AAAA,EAEb,QAAQ;A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A,GAAUzH,EAAM,QAAQ,SAAS,MAGjDwH,EAAa,SAAS,KACzB3E,EAAO,KAAK2E,CAAY,GAEzBA,IAAe,CAACxH,CAAK,GACrByH,IAAWzH,EAAM,QAAQ,QAAA;AAI3B,SAAIwH,EAAa,SAAS,KACzB3E,EAAO,KAAK2E,CAAY,GAGlB3E;AACR;AASO,SAASmG,GACfC,GACAC,GACAC,GACkC;AAClC,QAAMC,IAAO,KAAK,IAAI,GAAG,KAAK,IAAIH,GAAQC,CAAQ,CAAC,GAC7CG,IAAO,KAAK,IAAIF,GAAiB,KAAK,IAAIF,GAAQC,CAAQ,CAAC;AAEjE,SAAO;AAAA,IACN,KAAKE;AAAA,IACL,QAAQC,IAAOD;AAAA,EAAA;AAEjB;"}
1
+ {"version":3,"file":"utils.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,11 @@
1
+ "use strict";const e=require("react/jsx-runtime"),o=require("react"),a=require("./index-D2U2F80P.cjs"),wt=require("@radix-ui/react-dropdown-menu"),y=require("./position-utils-BQpbtF6N.cjs"),oe=require("./slot-selection-context-DBCZI2Dn.cjs"),vt=require("@radix-ui/react-dialog"),Nt=require("@radix-ui/react-popover"),kt=require("@radix-ui/react-tooltip");function be(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>t[s]})}}return n.default=t,Object.freeze(n)}const K=be(o),U=be(wt),V=be(vt),ue=be(Nt),je=be(kt);const Ye=(...t)=>t.filter((n,s,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===s).join(" ").trim();const Dt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ct=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,s,r)=>r?r.toUpperCase():s.toLowerCase());const $e=t=>{const n=Ct(t);return n.charAt(0).toUpperCase()+n.slice(1)};var St={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Mt=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const Tt=o.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:d="",children:h,iconNode:i,...b},C)=>o.createElement("svg",{ref:C,...St,width:n,height:n,stroke:t,strokeWidth:r?Number(s)*24/Number(n):s,className:Ye("lucide",d),...!h&&!Mt(b)&&{"aria-hidden":"true"},...b},[...i.map(([l,j])=>o.createElement(l,j)),...Array.isArray(h)?h:[h]]));const Me=(t,n)=>{const s=o.forwardRef(({className:r,...d},h)=>o.createElement(Tt,{ref:h,iconNode:n,className:Ye(`lucide-${Dt($e(t))}`,`lucide-${t}`,r),...d}));return s.displayName=$e(t),s};const Et=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],At=Me("check",Et);const Rt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],zt=Me("chevron-right",Rt);const Lt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_t=Me("circle",Lt);const Wt=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Je=Me("x",Wt),Ze=V.Root,Qe=V.Trigger,Bt=V.Portal,It=V.Close,et=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Overlay,{ref:s,className:a.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n}));et.displayName=V.Overlay.displayName;const _e=K.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(Bt,{children:[e.jsx(et,{}),e.jsxs(V.Content,{ref:r,className:a.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",t),...s,children:[n,e.jsxs(V.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Je,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=V.Content.displayName;const tt=({className:t,...n})=>e.jsx("div",{className:a.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...n});tt.displayName="DialogHeader";const nt=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Title,{ref:s,className:a.cn("text-lg font-semibold leading-none tracking-tight",t),...n}));nt.displayName=V.Title.displayName;const st=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Description,{ref:s,className:a.cn("text-sm text-muted-foreground",t),...n}));st.displayName=V.Description.displayName;const ae=ue.Root,ie=ue.Trigger,Ht=ue.Anchor,se=K.forwardRef(({className:t,align:n="center",sideOffset:s=4,...r},d)=>e.jsx(ue.Portal,{children:e.jsx(ue.Content,{ref:d,align:n,sideOffset:s,className:a.cn("z-50 w-72 rounded-xl border bg-white text-popover-foreground outline-none 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",t),...r})}));se.displayName=ue.Content.displayName;const rt=V.Root,ot=V.Trigger,Ot=V.Close,$t=V.Portal,at=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Overlay,{className:a.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n,ref:s}));at.displayName=V.Overlay.displayName;const We=K.forwardRef(({className:t,children:n,...s},r)=>e.jsxs($t,{children:[e.jsx(at,{}),e.jsxs(V.Content,{ref:r,className:a.cn("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500","inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",t),...s,children:[n,e.jsxs(V.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(Je,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));We.displayName="SheetContent";const it=({className:t,...n})=>e.jsx("div",{className:a.cn("flex flex-col space-y-2 text-center sm:text-left",t),...n});it.displayName="SheetHeader";const lt=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Title,{ref:s,className:a.cn("text-lg font-semibold text-foreground",t),...n}));lt.displayName=V.Title.displayName;const dt=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Description,{ref:s,className:a.cn("text-sm text-muted-foreground",t),...n}));dt.displayName=V.Description.displayName;const Pt=je.Provider,te=je.Root,ne=je.Trigger,ee=K.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(je.Content,{ref:r,sideOffset:n,className:a.cn("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",t),...s}));ee.displayName=je.Content.displayName;function re(t){return{blue:{bg:"bg-blue-50 dark:bg-blue-950/30",text:"text-blue-700 dark:text-blue-300",dot:"bg-blue-500",dotFill:"fill-blue-600 dark:fill-blue-500",border:"border-blue-400 dark:border-blue-600",accentBorder:"border-l-blue-500 dark:border-l-blue-400"},green:{bg:"bg-green-50 dark:bg-green-950/30",text:"text-green-700 dark:text-green-300",dot:"bg-green-500",dotFill:"fill-green-600 dark:fill-green-500",border:"border-green-400 dark:border-green-600",accentBorder:"border-l-green-500 dark:border-l-green-400"},red:{bg:"bg-red-50 dark:bg-red-950/30",text:"text-red-700 dark:text-red-300",dot:"bg-red-500",dotFill:"fill-red-600 dark:fill-red-500",border:"border-red-400 dark:border-red-600",accentBorder:"border-l-red-500 dark:border-l-red-400"},yellow:{bg:"bg-yellow-50 dark:bg-yellow-950/30",text:"text-yellow-700 dark:text-yellow-300",dot:"bg-yellow-500",dotFill:"fill-yellow-600 dark:fill-yellow-500",border:"border-yellow-400 dark:border-yellow-600",accentBorder:"border-l-yellow-500 dark:border-l-yellow-400"},purple:{bg:"bg-purple-50 dark:bg-purple-950/30",text:"text-purple-700 dark:text-purple-300",dot:"bg-purple-500",dotFill:"fill-purple-600 dark:fill-purple-500",border:"border-purple-400 dark:border-purple-600",accentBorder:"border-l-purple-500 dark:border-l-purple-400"},orange:{bg:"bg-orange-50 dark:bg-orange-950/30",text:"text-orange-700 dark:text-orange-300",dot:"bg-orange-500",dotFill:"fill-orange-600 dark:fill-orange-500",border:"border-orange-400 dark:border-orange-600",accentBorder:"border-l-orange-500 dark:border-l-orange-400"},pink:{bg:"bg-pink-50 dark:bg-pink-950/30",text:"text-pink-700 dark:text-pink-300",dot:"bg-pink-500",dotFill:"fill-pink-600 dark:fill-pink-500",border:"border-pink-400 dark:border-pink-600",accentBorder:"border-l-pink-500 dark:border-l-pink-400"},teal:{bg:"bg-teal-50 dark:bg-teal-950/30",text:"text-teal-700 dark:text-teal-300",dot:"bg-teal-500",dotFill:"fill-teal-600 dark:fill-teal-500",border:"border-teal-400 dark:border-teal-600",accentBorder:"border-l-teal-500 dark:border-l-teal-400"},gray:{bg:"bg-gray-50 dark:bg-gray-950/30",text:"text-gray-700 dark:text-gray-300",dot:"bg-gray-500",dotFill:"fill-gray-600 dark:fill-gray-500",border:"border-gray-400 dark:border-gray-600",accentBorder:"border-l-gray-500 dark:border-l-gray-400"},indigo:{bg:"bg-indigo-50 dark:bg-indigo-950/30",text:"text-indigo-700 dark:text-indigo-300",dot:"bg-indigo-500",dotFill:"fill-indigo-600 dark:fill-indigo-500",border:"border-indigo-400 dark:border-indigo-600",accentBorder:"border-l-indigo-500 dark:border-l-indigo-400"}}[t??"blue"]}function ct(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function ye({event:t,variant:n="full",badgeVariant:s="colored",onClick:r,className:d,showTime:h=!0,showDescription:i=!1,showParticipants:b=!1,style:C,disablePopover:l=!1,renderPopover:j,enableDrag:v=!1,enablePageTransition:u=!1,pageTransitionDuration:g=400,eventDetailMode:p="popover",renderEventDetail:N}){const f=re(t.color),[z,S]=o.useState(!1),[T,W]=o.useState(!1),[q,F]=o.useState(!1),[O,A]=o.useState(null),R=o.useRef(null),I=oe.useOptionalDragDrop(),$=oe.useOptionalInnoCalendar();o.useEffect(()=>{if(!l&&$?.focusEventId&&$.focusEventId===t.id){const G=setTimeout(()=>{S(!0),$.clearFocusEventId()},300);return()=>clearTimeout(G)}},[$?.focusEventId,t.id,l]);const k=t.endDate<ct(new Date),m=t.isCanceled??!1,L=v&&I&&!m&&!k,_=t.data,B=_?.meetingTookPlace??t.meetingTookPlace??!1,w=m?e.jsx(Vt,{className:"h-3 w-3 text-zinc-800 dark:text-zinc-200"}):B?e.jsx(Ft,{className:a.cn("h-3 w-3",f.text)}):null,c=_?.productName,x=_?.extendedProps,M=_?.nrParticipant,D=_?.siteName,H=_?.siteCity,Y=!!D||!!H,E=o.useCallback(()=>{if(!T){if(l&&r){r(t);return}if(u&&R.current){const G=R.current.getBoundingClientRect();A(G),F(!0)}else l||S(!0)}},[T,l,r,t,u]);o.useCallback(()=>{F(!1),A(null),l||S(!0)},[l]);const P=o.useCallback(()=>{S(!1)},[]),Z=o.useCallback(G=>{L&&(G.dataTransfer.effectAllowed="move",G.dataTransfer.setData("text/plain",t.id),W(!0),I?.startDrag?.(t))},[L,t,I]),X=o.useCallback(()=>{W(!1),I?.isDragging&&I.endDrag?.()},[I]),J=N?N({event:t,onClose:P}):j?j({event:t,onClose:P}):e.jsx(Ie,{event:t,onClose:P}),xe=G=>{switch(p){case"dialog":return e.jsxs(Ze,{open:z,onOpenChange:S,children:[e.jsx(Qe,{asChild:!0,children:G}),e.jsx(_e,{className:"sm:max-w-md",children:J})]});case"sheet":return e.jsxs(rt,{open:z,onOpenChange:S,children:[e.jsx(ot,{asChild:!0,children:G}),e.jsx(We,{children:J})]});case"custom":return G;default:return e.jsxs(ae,{open:z,onOpenChange:S,children:[e.jsx(ie,{asChild:!0,children:G}),e.jsx(se,{className:"w-80",children:J})]})}};if(n==="dot"){const G=e.jsx("button",{type:"button",onClick:E,className:a.cn("size-2 rounded-full cursor-pointer transition-opacity",f.dot,t.isCanceled&&"opacity-50",d),style:C,"aria-label":y.reactNodeToText(t.title)});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:G}),e.jsx(ee,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs opacity-80",children:y.formatEventTimeDisplay(t)})]})})]}):xe(e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:G}),e.jsx(ee,{children:e.jsx("div",{className:"font-medium",children:t.title})})]}))}if(n==="compact"){const G=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!L,onDragStart:Z,onDragEnd:X,onClick:l?E:void 0,onKeyDown:he=>{(he.key==="Enter"||he.key===" ")&&(he.preventDefault(),E())},className:a.cn("group flex w-full relative items-center shadow-[0_0_1px_rgba(0,0,0,0.3)] gap-0 rounded px-1.5 py-1 text-left text-xs transition-colors hover:opacity-80",L?"cursor-grab active:cursor-grabbing":"cursor-pointer",T&&"opacity-50",m?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 line-through":[s==="colored"&&[f.bg,f.text],s==="mixed"&&[f.bg,f.text],s==="dot"&&"bg-muted/50"],d),style:C,children:[["dot","mixed"].includes(s)&&!m&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot absolute -top-1 -left-1 shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:f.dotFill})}),e.jsx("span",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsxs("span",{className:"",children:[e.jsx("span",{className:"relative block overflow-hidden whitespace-nowrap text-xs leading-tight",style:{maskImage:"linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)",WebkitMaskImage:"linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)"},children:e.jsxs("span",{className:"inline-flex event-marquee",children:[e.jsx("span",{className:"shrink-0 px-1",children:t.title}),e.jsx("span",{className:"shrink-0 px-1",children:"•"}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 px-1",children:t.title}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 px-1",children:"•"})]})}),e.jsx("div",{className:a.cn("w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",f.border),children:y.formatEventTimeDisplay(t)})]})}),e.jsx("div",{className:"flex gap-0.5",children:w})]});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:G}),e.jsx(ee,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})})]}):xe(G)}const me=e.jsxs("button",{type:"button",onClick:E,className:a.cn("group relative flex w-full flex-col gap-1 rounded-md border-l-[3px] px-2 py-1.5 text-left transition-all","shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:shadow-[0_2px_6px_rgba(0,0,0,0.12)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",m?"bg-zinc-100 dark:bg-zinc-800 border-l-zinc-400 dark:border-l-zinc-600 text-zinc-500 dark:text-zinc-400 line-through":[s==="colored"&&[f.bg,f.accentBorder,f.text],s==="mixed"&&[f.bg,f.accentBorder,f.text],s==="dot"&&"bg-muted/50 border-l-neutral-400 dark:border-l-neutral-600"],d),style:C,children:[e.jsxs("div",{className:"flex items-start justify-between gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[["dot","mixed"].includes(s)&&!m&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:f.dotFill})}),e.jsx("span",{className:a.cn("text-sm font-medium truncate",!m&&s!=="dot"&&f.text,m&&"line-through"),children:t.title})]}),w]}),c&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c}),x&&x.length>0&&e.jsx("div",{className:"flex flex-col text-xs text-muted-foreground",children:x.map((G,he)=>e.jsx("div",{children:G},he))}),M!=null&&M>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Re,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[M," participant",M!==1?"s":""]})]}),h&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Be,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),Y&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(ut,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{className:"truncate",children:[D,D&&H?", ":"",H]})]}),i&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),b&&t.participants&&t.participants.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Re,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.participants.map(G=>G.name).join(", ")})]})]});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:me}),e.jsx(ee,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})})]}):xe(me)}function Be({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function Ft({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}function Vt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}function Re({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}function ut({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"}),e.jsx("circle",{cx:"12",cy:"10",r:"3"})]})}function Ie({event:t,onClose:n}){const s=re(t.color),r=t.isCanceled??!1;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:a.cn("size-4 rounded shrink-0 mt-0.5",s.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:a.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1",children:[e.jsx(Be,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"tabular-nums",children:y.formatEventTimeDisplay(t)})]})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),t.isRecurring&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"Recurring"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function He({event:t,position:n,hourHeight:s=96,badgeVariant:r="colored",onClick:d,className:h,disablePopover:i=!1,renderPopover:b,enableDrag:C=!0}){const l=re(t.color),[j,v]=o.useState(!1),[u,g]=o.useState(!1),p=oe.useOptionalDragDrop(),N=oe.useOptionalInnoCalendar();o.useEffect(()=>{if(!i&&N?.focusEventId&&N.focusEventId===t.id){const E=setTimeout(()=>{v(!0),N.clearFocusEventId()},300);return()=>clearTimeout(E)}},[N?.focusEventId,t.id,i]);const f=(t.endDate.getTime()-t.startDate.getTime())/(1e3*60),z=f/60*s-8,S=t.endDate<ct(new Date),T=t.isCanceled??!1,W=C&&p&&!T&&!S,q=f<=20,F=f<35,O=f>20,A=f>=45,R=t.data,I=R?.productName,$=R?.extendedProps,k=R?.nrParticipant,m=R?.siteName,L=R?.siteCity,_=!!m||!!L,B=r==="dot",w=o.useCallback(()=>{u||(i&&d?d(t):i||v(!0))},[u,i,d,t]),c=o.useCallback(()=>{v(!1)},[]),x=o.useCallback(E=>{if(!W)return;E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("text/plain",t.id);const P=E.currentTarget,Z=P.getBoundingClientRect();E.dataTransfer.setDragImage(P,E.clientX-Z.left,E.clientY-Z.top),g(!0),p?.startDrag?.(t)},[W,t,p]),M=o.useCallback(()=>{g(!1),p?.isDragging&&p.endDrag?.()},[p]),D=o.useCallback(E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),w())},[w]),H=e.jsx("div",{role:"button",tabIndex:0,draggable:!!W,onDragStart:x,onDragEnd:M,onKeyDown:D,onClick:u?void 0:w,className:a.cn("group flex w-full select-none overflow-hidden rounded-md border-l-[3px] text-xs text-left","shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:shadow-[0_2px_6px_rgba(0,0,0,0.12)]","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-all",W?"cursor-grab active:cursor-grabbing":"cursor-pointer",u&&"opacity-50",T?"bg-zinc-100 dark:bg-zinc-800 border-l-zinc-400 dark:border-l-zinc-600 text-zinc-500 dark:text-zinc-400 line-through":[!B&&[l.bg,l.accentBorder,l.text],B&&"bg-neutral-50 dark:bg-neutral-900 border-l-neutral-400 dark:border-l-neutral-600"],q?"flex-row items-center gap-1.5 px-2 py-0":F?"flex-col gap-0.5 px-2 py-0 justify-center":"flex-col gap-0.5 px-2 py-1.5",h),style:{height:`${Math.max(z,20)}px`},children:q?e.jsxs(e.Fragment,{children:[["mixed","dot"].includes(r)&&!T&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:l.dotFill})}),e.jsx("span",{className:a.cn("font-semibold truncate leading-none text-[11px]",!T&&B&&"text-foreground"),children:t.title}),e.jsx("span",{className:"shrink-0 text-[10px] leading-none opacity-75 tabular-nums",children:y.formatEventTimeDisplay(t)})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[["mixed","dot"].includes(r)&&!T&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:l.dotFill})}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsx("p",{className:a.cn("font-semibold truncate leading-tight",!T&&B&&"text-foreground"),children:t.title})})]}),A&&I&&e.jsx("p",{className:a.cn("text-[11px] truncate leading-tight",B?"text-muted-foreground":"opacity-80"),children:I}),A&&$&&$.length>0&&e.jsx("div",{className:a.cn("flex flex-col text-[11px] leading-tight",B?"text-muted-foreground":"opacity-80"),children:$.map((E,P)=>e.jsx("div",{children:E},P))}),k!=null&&k>0&&e.jsxs("div",{className:a.cn("flex items-center gap-1 text-[11px] leading-tight",B?"text-muted-foreground":"opacity-80"),children:[e.jsx(Re,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[k," participant",k!==1?"s":""]})]}),O&&e.jsxs("div",{className:a.cn("flex items-center gap-1 text-[11px] tabular-nums leading-tight",B?"text-muted-foreground":"opacity-90"),children:[e.jsx(Be,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),A&&_&&e.jsxs("div",{className:a.cn("flex items-center gap-1 text-[11px] truncate leading-tight",B?"text-muted-foreground":"opacity-80"),children:[e.jsx(ut,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{className:"truncate",children:[m,m&&L?", ":"",L]})]})]})}),Y=e.jsx(ee,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),I&&e.jsx("div",{className:"text-xs text-muted-foreground",children:I}),$&&$.length>0&&$.map((E,P)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:E},P)),k!=null&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[k," participant",k!==1?"s":""]}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)}),_&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[m,m&&L?", ":"",L]})]})});return i?e.jsx("div",{className:"absolute p-0.5",style:{top:`${n.top}px`,left:`${n.left}%`,width:n.minWidth?`max(${n.minWidth}px, ${n.width}%)`:`${n.width}%`,minWidth:n.minWidth?`${n.minWidth}px`:void 0},children:e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:H}),Y]})}):e.jsx("div",{className:"absolute p-0.5",style:{top:`${n.top}px`,left:`${n.left}%`,width:n.minWidth?`max(${n.minWidth}px, ${n.width}%)`:`${n.width}%`,minWidth:n.minWidth?`${n.minWidth}px`:void 0},children:e.jsxs(ae,{open:j,onOpenChange:v,children:[e.jsx(ie,{asChild:!0,children:H}),e.jsx(se,{className:"w-80",children:b?b({event:t,onClose:c}):e.jsx(Ie,{event:t,onClose:c})})]})})}function qt({event:t,spanDays:n,isStart:s,isEnd:r,onClick:d,className:h,disablePopover:i=!1,renderPopover:b}){const C=re(t.color),[l,j]=o.useState(!1),v=t.isCanceled??!1,u=o.useCallback(()=>{i&&d?d(t):i||j(!0)},[i,d,t]),g=o.useCallback(()=>{j(!1)},[]),p=e.jsx("button",{type:"button",onClick:u,className:a.cn("flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",v?"bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[C.dot,"text-white"],s&&"rounded-l",r&&"rounded-r",!s&&"border-l-0",!r&&"border-r-0",h),style:{width:`${n*100}%`},children:s&&e.jsx("span",{className:"truncate",children:t.title})}),N=e.jsx(ee,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})});return i?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:p}),N]}):e.jsxs(ae,{open:l,onOpenChange:j,children:[e.jsx(ie,{asChild:!0,children:p}),e.jsx(se,{className:"w-80",children:b?b({event:t,onClose:g}):e.jsx(Ie,{event:t,onClose:g})})]})}if(typeof window<"u"&&!document.getElementById("inno-calendar-event-marquee-style")){const t=document.createElement("style");t.id="inno-calendar-event-marquee-style",t.innerHTML=`
2
+ @keyframes event-marquee {
3
+ 0% { transform: translateX(0); }
4
+ 100% { transform: translateX(-50%); }
5
+ }
6
+ .event-marquee {
7
+ animation: event-marquee 28s linear infinite;
8
+ will-change: transform;
9
+ }
10
+ `,document.head.appendChild(t)}const Pe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Fe=a.clsx,xt=(t,n)=>s=>{var r;if(n?.variants==null)return Fe(t,s?.class,s?.className);const{variants:d,defaultVariants:h}=n,i=Object.keys(d).map(l=>{const j=s?.[l],v=h?.[l];if(j===null)return null;const u=Pe(j)||Pe(v);return d[l][u]}),b=s&&Object.entries(s).reduce((l,j)=>{let[v,u]=j;return u===void 0||(l[v]=u),l},{}),C=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((l,j)=>{let{class:v,className:u,...g}=j;return Object.entries(g).every(p=>{let[N,f]=p;return Array.isArray(f)?f.includes({...h,...b}[N]):{...h,...b}[N]===f})?[...l,v,u]:l},[]);return Fe(t,i,C,s?.class,s?.className)},mt=xt("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input active:!bg-zinc-100 hover:!bg-zinc-50 active:bg-white !bg-white hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),le=o.forwardRef(({className:t,variant:n,size:s,loading:r,disabled:d,children:h,...i},b)=>e.jsxs("button",{className:a.cn(mt({variant:n,size:s,className:t})),ref:b,disabled:d||r,...i,children:[r&&e.jsxs("svg",{className:"animate-spin -ml-1 mr-2 size-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),h]}));le.displayName="Button";const ze=U.Root,Le=U.Trigger,Gt=K.forwardRef(({className:t,inset:n,children:s,...r},d)=>e.jsxs(U.SubTrigger,{ref:d,className:a.cn("flex cursor-default select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",n&&"pl-8",t),...r,children:[s,e.jsx(zt,{className:"ml-auto h-4 w-4"})]}));Gt.displayName=U.SubTrigger.displayName;const Ut=K.forwardRef(({className:t,...n},s)=>e.jsx(U.SubContent,{ref:s,className:a.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",t),...n}));Ut.displayName=U.SubContent.displayName;const De=K.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(U.Portal,{children:e.jsx(U.Content,{ref:r,sideOffset:n,className:a.cn("z-50 rounded-xl border bg-popover p-1 text-popover-foreground shadow-sm 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",t),...s})}));De.displayName=U.Content.displayName;const Ce=K.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(U.Item,{ref:r,className:a.cn("relative flex cursor-pointer select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",t),...s}));Ce.displayName=U.Item.displayName;const Kt=K.forwardRef(({className:t,children:n,checked:s=!1,...r},d)=>e.jsxs(U.CheckboxItem,{ref:d,className:a.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:s,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(U.ItemIndicator,{children:e.jsx(At,{className:"h-4 w-4"})})}),n]}));Kt.displayName=U.CheckboxItem.displayName;const Xt=K.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(U.RadioItem,{ref:r,className:a.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(U.ItemIndicator,{children:e.jsx(_t,{className:"h-2 w-2 fill-current"})})}),n]}));Xt.displayName=U.RadioItem.displayName;const Yt=K.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(U.Label,{ref:r,className:a.cn("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...s}));Yt.displayName=U.Label.displayName;const Jt=K.forwardRef(({className:t,...n},s)=>e.jsx(U.Separator,{ref:s,className:a.cn("-mx-1 my-1 h-px bg-muted",t),...n}));Jt.displayName=U.Separator.displayName;const Zt=xt("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ht({className:t,variant:n,...s}){return e.jsx("div",{className:a.cn(Zt({variant:n}),t),...s})}function Qt({className:t}){return e.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function en({className:t}){return e.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}const tn=["January","February","March","April","May","June","July","August","September","October","November","December"];function pt({date:t,view:n,events:s=[],onNavigatePrev:r,onNavigateNext:d,weekStartsOn:h=1,showEventCount:i=!0,className:b}){const C=tn[t.getMonth()],l=t.getFullYear(),j=i?y.getEventsCountInView(s,t,n,h):0,v=y.getRangeText(t,n);return e.jsxs("div",{className:a.cn("min-w-0 flex-1",b),children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-base sm:text-lg font-semibold truncate",children:[C," ",l]}),i&&e.jsx(ht,{variant:"outline",className:"px-1 sm:px-1.5 text-[10px] sm:text-xs shrink-0",children:j})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsx(le,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:r,children:e.jsx(Qt,{})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:v}),e.jsx(le,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:d,children:e.jsx(en,{})})]})]})}const nn=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function ft({onClick:t,className:n}){const s=new Date;return e.jsxs("button",{type:"button",className:a.cn("flex size-11 sm:size-14 flex-col items-start overflow-hidden rounded-lg border shrink-0","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","hover:bg-accent/50 transition-colors",n),onClick:t,children:[e.jsx("p",{className:"flex h-4 sm:h-6 w-full items-center justify-center bg-primary text-center text-[10px] sm:text-xs font-semibold text-primary-foreground",children:nn[s.getMonth()]}),e.jsx("p",{className:"flex w-full flex-1 items-center justify-center text-sm sm:text-lg font-bold",children:s.getDate()})]})}function sn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("path",{d:"M3 10h18"}),e.jsx("path",{d:"M8 14h.01"}),e.jsx("path",{d:"M12 14h.01"}),e.jsx("path",{d:"M16 14h.01"}),e.jsx("path",{d:"M8 18h.01"}),e.jsx("path",{d:"M12 18h.01"}),e.jsx("path",{d:"M16 18h.01"})]})}function ce({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M9 8h7"}),e.jsx("path",{d:"M8 12h6"}),e.jsx("path",{d:"M11 16h5"})]})}function Ve({className:t}){return e.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function rn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function qe({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"M12 5v14"})]})}function on({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),e.jsx("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}),e.jsx("path",{d:"M14 4h7"}),e.jsx("path",{d:"M14 9h7"}),e.jsx("path",{d:"M14 15h7"}),e.jsx("path",{d:"M14 20h7"})]})}function an({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M12 3v18"})]})}function ln({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M3 12h18"}),e.jsx("path",{d:"M12 3v18"})]})}function dn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M3 9h18"}),e.jsx("path",{d:"M3 15h18"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M15 3v18"})]})}const cn=[{value:"day",label:"Day",icon:on},{value:"week",label:"Week",icon:an},{value:"month",label:"Month",icon:ln},{value:"year",label:"Year",icon:dn}],Ge=[{value:"timeline-day",label:"1 Day",icon:ce},{value:"timeline-3day",label:"3 Days",icon:ce},{value:"timeline-week",label:"7 Days",icon:ce}],un=[{value:"resource-day",label:"1 Day",icon:ce},{value:"resource-week",label:"7 Days",icon:ce}];function xn({currentDate:t,view:n,events:s=[],onNavigateToday:r,onNavigatePrev:d,onNavigateNext:h,onNavigate:i,onViewChange:b,onAddEvent:C,availableViews:l=["day","week","month","agenda"],showTimelineViews:j=!1,timelineViews:v,settingsContent:u,showSettings:g=!1,filterContent:p,actions:N,className:f,weekStartsOn:z=1,headerConfig:S,labels:T={}}){const W=S?.showToday??!0,q=S?.showDateNavigator??!0,F=S?.showCalendarViews??!0,O=S?.showResourceViews??j,A=S?.showSettings??g,R=S?.showAddEvent??!0,I=S?.showFilters??!0,$=o.useMemo(()=>({today:"Today",addEvent:"Add Event",calendarView:"Calendar View",resourceView:"Resource View",...T}),[T]),k=()=>{r?.(),i?.("today")},m=()=>{d?.(),i?.("prev")},L=()=>{h?.(),i?.("next")},_=["day","week","month","year","agenda"].includes(n),B=n.startsWith("timeline-")||n.startsWith("resource-"),w=cn.filter(D=>l.includes(D.value)),c=_?w.find(D=>D.value===n):null,x=[...Ge,...un],M=B?x.find(D=>D.value===n):null;return e.jsxs("div",{className:a.cn("flex flex-col w-full gap-3 mb-2",f),children:[e.jsxs("div",{className:"flex lg:flex-row flex-col w-full justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[W&&e.jsx(ft,{onClick:k}),q&&e.jsx(pt,{date:t,view:n,events:s,onNavigatePrev:m,onNavigateNext:L,weekStartsOn:z})]}),R&&C&&e.jsx(le,{size:"icon",className:"shrink-0 lg:hidden",onClick:C,children:e.jsx(qe,{className:"size-4"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-none",children:[F&&b&&w.length>0&&e.jsxs(ze,{children:[e.jsxs(Le,{className:a.cn("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors","h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",_?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-input bg-background hover:bg-accent hover:text-accent-foreground"),children:[e.jsx(sn,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:c?.label??$.calendarView}),e.jsx(Ve,{className:"size-3 opacity-60"})]}),e.jsx(De,{align:"start",className:"min-w-[120px]",children:w.map(D=>{const H=D.icon;return e.jsxs(Ce,{onClick:()=>b(D.value),className:a.cn("gap-2",n===D.value&&"bg-accent"),children:[e.jsx(H,{className:"size-4"}),e.jsx("span",{children:D.label})]},D.value)})})]}),O&&b&&e.jsxs(ze,{children:[e.jsxs(Le,{className:a.cn("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors","h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",B?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-input bg-white hover:bg-zinc-50 hover:text-accent-foreground"),children:[e.jsx(ce,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:M?.label??$.resourceView}),e.jsx(Ve,{className:"size-3 opacity-60"})]}),e.jsx(De,{align:"start",className:"min-w-[120px]",children:Ge.map(D=>{const H=D.icon;return e.jsxs(Ce,{onClick:()=>b(D.value),className:a.cn("gap-2",n===D.value&&"bg-accent"),children:[e.jsx(H,{className:"size-4"}),e.jsx("span",{children:D.label})]},D.value)})})]}),A&&u&&e.jsxs(ae,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(le,{variant:"outline",size:"icon",className:"min-w-10 min-h-10 shrink-0 mx-0",children:e.jsx(rn,{className:"size-4 sm:size-5"})})}),e.jsx(se,{className:"w-auto min-w-80 p-0",align:"end",sideOffset:8,children:e.jsx("div",{className:"max-h-[70vh] overflow-y-auto p-4 space-y-6",children:u})})]}),N,R&&C&&e.jsxs(le,{className:"hidden lg:flex shrink-0 max-h-10",onClick:C,children:[e.jsx(qe,{className:"size-4"}),$.addEvent]})]})]}),I&&p&&e.jsx("div",{className:"flex items-center gap-2 pb-1 -mb-1 scrollbar-none",children:p})]})}function mn({events:t,date:n,daysAhead:s=60,badgeVariant:r="colored",onEventClick:d,className:h,renderEvent:i,renderPopover:b,slots:C,classNames:l}){const j=o.useMemo(()=>{const u=new Date(n);u.setHours(0,0,0,0);const g=new Date(u);return g.setDate(g.getDate()+s),t.filter(p=>p.endDate>=u&&p.startDate<=g)},[t,s,n]),v=o.useMemo(()=>{const u=y.groupEventsByDate(j),g=[];for(const[p,N]of u)g.push({date:new Date(p),dateKey:p,events:N});return g.sort((p,N)=>p.date.getTime()-N.date.getTime()),g},[j]);return v.length===0?e.jsx("div",{className:a.cn("flex flex-col items-center justify-center h-full py-12",h),children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-muted-foreground",children:"No events found"}),e.jsx("p",{className:"text-sm text-muted-foreground/70",children:"No events scheduled for this period"})]})}):e.jsxs("div",{className:a.cn("flex flex-col h-full overflow-auto",l?.agendaList,h),children:[e.jsx("div",{className:"sticky top-0 z-10 bg-background border-b px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-medium",children:"Schedule"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[j.length," event",j.length!==1?"s":""]})]})}),e.jsx("div",{className:"flex-1",children:v.map(({date:u,dateKey:g,events:p})=>{const N=y.isToday(u),f=u.toLocaleDateString([],{weekday:"short"}),z=u.getDate(),S=u.toLocaleDateString([],{month:"short"});return e.jsxs("div",{className:a.cn("",l?.agendaDayGroup),children:[e.jsx("div",{className:a.cn("sticky top-[52px] z-10 bg-background px-4 py-3 border-b",l?.agendaDayHeader),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center min-w-[40px]",children:[e.jsx("span",{className:a.cn("text-[11px] font-medium uppercase tracking-wide",N?"text-primary":"text-muted-foreground"),children:f}),e.jsx("span",{className:a.cn("flex items-center justify-center rounded-full mt-0.5","size-10 text-xl font-normal",N?"bg-primary text-primary-foreground":"text-foreground"),children:z})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[S," ",u.getFullYear()]})]})}),e.jsx("div",{className:"px-4 py-3 space-y-2 border-b last:border-b-0",children:p.map(T=>i?e.jsx("div",{children:i({event:T,variant:"full"})},T.id):e.jsx(ye,{event:T,variant:"full",badgeVariant:r,onClick:d,disablePopover:!!d&&!b,renderPopover:b,showTime:!0,showDescription:!0,showParticipants:!0,...l?.eventCard&&{className:l.eventCard}},T.id))})]},g)})})]})}const we=360,ve=480,Te=280;function gt({isOpen:t,onClose:n,date:s,events:r,anchorRect:d,badgeVariant:h="colored",onEventClick:i,renderEvent:b,renderPopover:C,className:l}){const j=o.useRef(null),v=o.useRef(null),[u,g]=o.useState("closed"),p=o.useRef(null);d&&(p.current=d);const N=d??p.current,f=o.useMemo(()=>[...r].sort((A,R)=>A.startDate.getTime()-R.startDate.getTime()),[r]),z=o.useMemo(()=>{const A=N;if(!A)return{top:0,left:0,width:we,maxHeight:ve};const R=typeof window<"u"?window.innerWidth:1200,I=typeof window<"u"?window.innerHeight:800;let $=A.left+A.width/2-we/2;$=Math.max(16,Math.min($,R-we-16));const k=Math.min(r.length*68+80,ve);let m=A.top+A.height/2-k/2;return m=Math.max(16,Math.min(m,I-k-16)),{top:m,left:$,width:we,maxHeight:ve}},[N,r.length]);o.useLayoutEffect(()=>{if(t&&N)g("entering"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{g("open")})});else if(!t&&(u==="open"||u==="entering")){g("exiting");const A=setTimeout(()=>{g("closed"),p.current=null},Te);return()=>clearTimeout(A)}},[t,N]),o.useEffect(()=>{if(u==="closed")return;const A=R=>{R.key==="Escape"&&(R.stopPropagation(),n())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[u,n]),o.useEffect(()=>{u==="open"&&v.current&&v.current.focus()},[u]);const S=o.useCallback(A=>{A.target===j.current&&n()},[n]);if(u==="closed")return null;const T=u==="entering"||u==="exiting",W=N,q=T&&W?{position:"fixed",top:W.top,left:W.left,width:W.width,height:W.height,maxHeight:W.height,opacity:u==="entering"?.7:0,transform:"scale(1)",borderRadius:"8px"}:{position:"fixed",top:z.top,left:z.left,width:z.width,maxHeight:z.maxHeight,opacity:1,transform:"scale(1)",borderRadius:"12px"},F=T?0:1,O=s.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"});return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:j,role:"presentation",onClick:S,className:"ic-expansion-backdrop",style:{position:"fixed",inset:0,zIndex:40,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:F,transition:`opacity ${Te}ms cubic-bezier(0.32, 0.72, 0, 1)`}}),e.jsxs("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":`Events for ${O}`,tabIndex:-1,className:a.cn("ic-expansion-panel","!bg-white border border-border shadow-2xl overflow-hidden","focus:outline-none",l),style:{...q,zIndex:41,transition:`all ${Te}ms cubic-bezier(0.32, 0.72, 0, 1)`,willChange:"top, left, width, height, max-height, opacity, border-radius"},children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b bg-muted/30",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:O}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.length," event",r.length!==1?"s":""]})]}),e.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center size-7 rounded-full hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":"Close",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]}),e.jsxs("div",{className:"overflow-y-auto px-3 py-2 space-y-1.5",style:{maxHeight:`${ve-64}px`},children:[f.map(A=>e.jsx("div",{onPointerDown:R=>R.stopPropagation(),children:b?b({event:A,variant:"compact"}):e.jsx(ye,{event:A,variant:"compact",badgeVariant:h,onClick:i,renderPopover:C,showTime:!0})},A.id)),r.length===0&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No events"})]})]})]})}function hn({event:t,date:n,onEventClick:s,disablePopover:r,renderPopover:d}){const[h,i]=o.useState(!1),b=re(t.color),C=y.detectAllDayEvent(t),l=y.isSameDay(t.startDate,n),j=y.isSameDay(t.endDate,n),v=C&&y.isSameDay(t.startDate,t.endDate),u=o.useCallback(()=>{r&&s?s(t):r||i(!0)},[r,s,t]),g=o.useCallback(()=>{i(!1)},[]),p=e.jsxs("button",{type:"button",onClick:u,title:y.formatEventTimeDisplay(t),className:a.cn("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium transition-opacity hover:opacity-80","sm:px-2 sm:py-1 sm:text-xs",b.bg,b.text,t.isCanceled&&"opacity-60 line-through"),children:[!v&&l&&!j&&"→ ",!v&&!l&&j&&" ←",!v&&!l&&!j&&"↔ ",e.jsx("span",{className:"truncate max-w-24 sm:max-w-32",children:t.title}),v&&e.jsx("span",{className:"text-[9px] opacity-70 sm:text-[10px]",children:"All day"})]}),N=e.jsx(ee,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})});return r?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:p}),N]}):e.jsxs(ae,{open:h,onOpenChange:i,children:[e.jsx(ie,{asChild:!0,children:p}),e.jsx(se,{className:"w-80",children:d?d({event:t,onClose:g}):e.jsx(pn,{event:t,onClose:g})})]})}function pn({event:t,onClose:n}){const s=re(t.color),r=t.isCanceled??!1;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:a.cn("size-4 rounded shrink-0 mt-0.5",s.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:a.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums",children:y.formatEventTimeDisplay(t)})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function yt({events:t,date:n,onEventClick:s,disablePopover:r=!1,renderPopover:d,className:h}){if(t.length===0)return null;const i=t.some(l=>y.detectAllDayEvent(l)&&y.isSameDay(l.startDate,l.endDate)),b=t.some(l=>!y.isSameDay(l.startDate,l.endDate)||y.detectAllDayEvent(l)&&!y.isSameDay(l.startDate,l.endDate)),C=i&&b?"All day / Multi-day":i?"All day":"Multi-day";return e.jsxs("div",{className:a.cn("border-b bg-muted/20 px-2 py-1.5 space-y-1","sm:px-4 sm:py-2",h),children:[e.jsx("span",{className:"text-[10px] font-medium text-muted-foreground sm:text-xs",children:C}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(l=>e.jsx(hn,{event:l,date:n,onEventClick:s,disablePopover:r,renderPopover:d},l.id))})]})}const fn=5;function bt({slot:t,onSelectionStart:n,onSelectionMove:s,onSelectionEnd:r,isSelected:d=!1,isSelecting:h=!1,disabled:i=!1,ariaLabel:b,children:C,className:l,height:j,style:v,dataAttributes:u}){const g=o.useRef(null),p=o.useRef(!1),N=o.useRef(!1),f=o.useRef(null),[z,S]=o.useState(!1),T=oe.useOptionalDragDrop(),W=o.useCallback(k=>{i||k.button!==0&&k.pointerType==="mouse"||(k.preventDefault(),g.current={x:k.clientX,y:k.clientY},p.current=!1,N.current=!0,n?.(t))},[i,t,n]),q=o.useCallback(k=>{if(!(g.current&&N.current&&!i))return;const m=k.clientX-g.current.x,L=k.clientY-g.current.y;Math.sqrt(m*m+L*L)>=fn&&(p.current=!0)},[i]),F=o.useCallback(k=>{i||(k.buttons>0||h)&&s?.(t)},[i,h,t,s]),O=o.useCallback(()=>{i||(r?.(),g.current=null,p.current=!1,N.current=!1)},[i,r]),A=o.useCallback(k=>{if(!T?.isDragging||i)return;k.preventDefault(),k.dataTransfer.dropEffect="move",S(!0);const m=new Date,L=t.hour??m.getHours(),_=t.minute??(m.getMinutes()>=30?30:0);T.updateDragPreview?.(t.date,L,_)},[T,i,t]),R=o.useCallback(()=>{S(!1)},[]),I=o.useCallback(k=>{k.preventDefault(),S(!1),!(!T?.isDragging||i)&&T.endDrag?.()},[T,i]);o.useEffect(()=>{const k=()=>{N.current&&(N.current=!1,g.current=null,p.current=!1)};return window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k),()=>{window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k)}},[]);const $=o.useCallback(k=>{i||(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),n?.(t),r?.())},[i,t,n,r]);return e.jsx("button",{ref:f,type:"button","aria-label":b,"aria-disabled":i,"aria-pressed":d,disabled:i,onPointerDown:W,onPointerMove:q,onPointerUp:O,onPointerEnter:F,onKeyDown:$,onDragOver:A,onDragLeave:R,onDrop:I,className:a.cn("select-none touch-none cursor-pointer transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",!(h||i)&&"hover:bg-blue-50/60",d&&"bg-blue-100/70",z&&"bg-primary/20 ring-2 ring-primary ring-inset",i&&"cursor-not-allowed opacity-50",l),style:{height:j,...v},...u,children:C})}function Oe({slot:t,date:n,hour:s,minute:r,ariaLabel:d,...h}){const i=t??{date:n,hour:s??0,minute:r??0},b=d??`Add event at ${(i.hour??0).toString().padStart(2,"0")}:${(i.minute??0).toString().padStart(2,"0")} on ${i.date.toLocaleDateString()}`;return e.jsx(bt,{slot:i,ariaLabel:b,...h})}function jt({slot:t,date:n,ariaLabel:s,...r}){const d=t??{date:n},h=s??`Select ${d.date.toLocaleDateString()}`;return e.jsx(bt,{slot:d,ariaLabel:h,...r})}const pe=96,Ee=72,Ae=80;function gn({events:t,date:n,visibleHours:s={startHour:0,endHour:24},workingHours:r,slotDuration:d=30,badgeVariant:h="colored",onEventClick:i,onSlotSelect:b,className:C,renderEvent:l,renderPopover:j,slots:v,classNames:u}){const g=60/d,p=100/g,N=o.useMemo(()=>{const w=[];for(let c=0;c<g;c++)w.push(c*d);return w},[g,d]),f=o.useMemo(()=>y.getEventsForDay(t,n),[t,n]),{singleDay:z,multiDay:S}=o.useMemo(()=>y.separateEventsByDuration(f),[f]),T=o.useMemo(()=>{const w=y.calculateOverlappingPositions(z,n,s,pe),c=new Map;for(const x of w)c.set(x.event.id,x.position);return c},[z,n,s]),W=o.useMemo(()=>y.getVisibleHoursArray(s),[s]),q=new Date,F=y.isToday(n),O=o.useMemo(()=>{if(!F)return 0;const w=q.getHours()+q.getMinutes()/60;return w<s.startHour||w>s.endHour?-1:(w-s.startHour)*pe},[F,s,q]),A=o.useRef(null);o.useLayoutEffect(()=>{const w=A.current;if(!w)return;const c=()=>{let x;if(F){const D=new Date().getHours();x=Math.max(D-1,s.startHour)}else{const D=n.getDay(),H=r?.[D];H?.enabled&&H.from>0?x=Math.max(H.from-1,s.startHour):x=Math.max(7,s.startHour)}const M=(x-s.startHour)*pe;w.scrollTo({top:M,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(c)})},[n,r,s,F]);const R=oe.useOptionalSlotSelection(),I=o.useCallback(w=>{R?.startSelection(w)},[R]),$=o.useCallback(w=>{R?.updateSelection(w)},[R]),k=o.useCallback(()=>{R?.endSelection()},[R]),m=o.useCallback(w=>{i?.(w)},[i]),L=n.toLocaleDateString([],{weekday:"short"}),_=n.getDate(),B=y.isToday(n);return e.jsxs("div",{className:a.cn("flex flex-col h-full",C),children:[e.jsx("div",{className:a.cn("flex items-center gap-3 border-b px-4 py-3",u?.columnHeader,B&&u?.columnHeaderToday),children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:a.cn("text-[11px] font-medium uppercase tracking-wide",B?"text-primary":"text-muted-foreground"),children:L}),e.jsx("span",{className:a.cn("flex items-center justify-center rounded-full mt-0.5","size-12 text-3xl font-normal",B?"bg-primary text-primary-foreground":"text-foreground"),children:_})]})}),S.length>0&&e.jsx(yt,{events:S,date:n,onEventClick:m,disablePopover:!!i&&!j,renderPopover:j,...u?.multiDayBanner&&{className:u.multiDayBanner}}),e.jsx("div",{ref:A,className:a.cn("flex-1",u?.scrollContainer),children:e.jsxs("div",{className:"relative min-h-full",children:[W.map((w,c)=>{const M=!y.isWorkingHour(n,w,r);return e.jsxs("div",{className:a.cn("relative flex",M&&"bg-calendar-disabled-hour",u?.timeSlot,M?u?.timeSlotNonWorking:u?.timeSlotWorking),style:{height:pe},children:[e.jsx("div",{className:a.cn("relative flex-shrink-0 border-r border-border/50 bg-zinc-50 dark:bg-zinc-900",u?.timeGutter),style:{width:Ee},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:c!==0&&e.jsx("span",{className:a.cn("text-[10px] sm:text-xs text-muted-foreground",u?.timeGutterLabel),children:y.formatHourLabel(w)})})}),e.jsxs("div",{className:"relative flex-1",children:[F&&!M&&e.jsx("div",{className:"absolute inset-0 bg-primary/5"}),c!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),N.slice(1).map(D=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${D/60*100}%`}},D)),N.map((D,H)=>{const Y={date:n,hour:w,minute:D};return e.jsx(Oe,{slot:Y,onSelectionStart:I,onSelectionMove:$,onSelectionEnd:k,isSelected:R?.isSlotSelected(Y)??!1,isSelecting:R?.isSelecting??!1,disabled:M,className:"absolute inset-x-0",style:{top:`${H*p}%`,height:`${p}%`},ariaLabel:`Add event at ${y.formatHourLabel(w)}:${String(D).padStart(2,"0")}`},D)})]})]},w)}),e.jsx("div",{className:"absolute top-0 bottom-0 right-0 pointer-events-none",style:{left:Ee},children:z.map(w=>{const c=T.get(w.id);if(!c)return null;const x=`calc(${c.width}% - 2px)`,M=`max(${Ae}px, ${x})`;return l?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${c.top}px`,left:`${c.left}%`,width:M,minWidth:`${Ae}px`},children:l({event:w,position:c})},w.id):e.jsx(He,{event:w,position:{top:c.top,left:c.left,width:c.width,minWidth:Ae},hourHeight:pe,badgeVariant:h,onClick:i,disablePopover:!!i&&!j,renderPopover:j,className:a.cn("pointer-events-auto",u?.eventCard)},w.id)})}),F&&O>=0&&e.jsxs("div",{className:a.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",u?.currentTimeIndicator),style:{top:O,left:Ee},children:[e.jsx("div",{className:"h-2.5 w-2.5 -ml-1 rounded-full bg-red-500"}),e.jsx("div",{className:"flex-1 h-0.5 bg-red-500"})]})]})})]})}const yn=[{full:"Monday",short:"Mon",tiny:"M"},{full:"Tuesday",short:"Tue",tiny:"T"},{full:"Wednesday",short:"Wed",tiny:"W"},{full:"Thursday",short:"Thu",tiny:"T"},{full:"Friday",short:"Fri",tiny:"F"},{full:"Saturday",short:"Sat",tiny:"S"},{full:"Sunday",short:"Sun",tiny:"S"}],bn=[{full:"Sunday",short:"Sun",tiny:"S"},{full:"Monday",short:"Mon",tiny:"M"},{full:"Tuesday",short:"Tue",tiny:"T"},{full:"Wednesday",short:"Wed",tiny:"W"},{full:"Thursday",short:"Thu",tiny:"T"},{full:"Friday",short:"Fri",tiny:"F"},{full:"Saturday",short:"Sat",tiny:"S"}],fe=3;function jn({events:t,date:n,weekStartsOn:s=1,badgeVariant:r="colored",onEventClick:d,onSlotSelect:h,onDayClick:i,className:b,renderEvent:C,renderPopover:l,showMoreMode:j,showMoreEventsInPopover:v=!1,slots:u,classNames:g}){const p=j??(v?"popover":"expand"),N=u?.dayCellHeader,f=u?.dayCellFooter,[z,S]=o.useState(null),[T,W]=o.useState(null),q=o.useMemo(()=>y.generateMonthGrid(n,s),[n,s]),F=o.useMemo(()=>{const m=new Map;for(const L of q){const _=L.date.toDateString(),B=y.getEventsForDay(t,L.date);B.sort((w,c)=>w.startDate.getTime()-c.startDate.getTime()),m.set(_,B)}return m},[q,t]),O=oe.useOptionalSlotSelection(),A=o.useCallback(m=>{O?.startSelection(m)},[O]),R=o.useCallback(m=>{O?.updateSelection(m)},[O]),I=o.useCallback(()=>{O?.endSelection()},[O]),$=o.useCallback(m=>{i?.(m)},[i]),k=s===0?bn:yn;return e.jsxs("div",{className:a.cn("flex flex-col h-full overflow-hidden",b),children:[e.jsx("div",{className:"flex flex-col flex-1 overflow-auto",children:e.jsxs("div",{className:"flex flex-col flex-1 min-w-[560px] sm:min-w-0",children:[e.jsx("div",{className:a.cn("grid grid-cols-7 border-b !sticky !top-0 bg-background z-10",g?.weekdayHeader),children:k.map((m,L)=>e.jsxs("div",{className:a.cn("py-2 sm:py-2.5 text-center text-[11px] uppercase font-medium tracking-wide text-muted-foreground",L>=5&&"text-muted-foreground/70",g?.weekdayLabel),children:[e.jsx("span",{className:"sm:hidden",children:m.short}),e.jsx("span",{className:"hidden sm:inline",children:m.short})]},m.full))}),e.jsx("div",{className:a.cn("grid grid-cols-7 auto-rows-min",g?.monthGrid),children:q.map(m=>{const L=m.date.toDateString(),_=F.get(L)||[],B=y.isToday(m.date),w=m.date.getDay()===0||m.date.getDay()===6,c=_.length>fe;return e.jsxs(jt,{date:m.date,dataAttributes:{"data-day-key":L},onSelectionStart:A,onSelectionMove:R,onSelectionEnd:I,isSelected:O?.isSlotSelected({date:m.date})??!1,isSelecting:O?.isSelecting??!1,className:a.cn("relative flex flex-col border-r border-b text-left min-h-[80px] sm:min-h-[100px] overflow-hidden","[&:nth-child(7n)]:border-r-0",!m.isCurrentMonth&&"bg-muted/20",w&&m.isCurrentMonth&&"bg-muted/10",g?.dayCell,B&&g?.dayCellToday,!m.isCurrentMonth&&g?.dayCellOutside,w&&g?.dayCellWeekend),ariaLabel:`${m.date.toLocaleDateString()} - ${_.length} events. Click to create event, double-click to view day.`,children:[e.jsx("div",{className:a.cn("flex items-center justify-center p-1",!m.isCurrentMonth&&"text-muted-foreground/40",g?.dayCellNumber),children:e.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),$(m.date)},className:a.cn("flex items-center justify-center rounded-full transition-colors","size-7 text-sm font-normal",B?"bg-primary text-primary-foreground":"hover:bg-muted"),children:m.date.getDate()})}),N&&e.jsx(N,{date:m.date,events:_,isToday:B,isCurrentMonth:m.isCurrentMonth,isWeekend:w,view:"month"}),e.jsxs("div",{className:a.cn("flex-1 overflow-hidden px-2 pt-1 pb-1 space-y-1",g?.dayCellContent),children:[_.slice(0,fe).map(x=>e.jsx("div",{onPointerDown:M=>{M.stopPropagation()},children:C?C({event:x,variant:"compact"}):e.jsx(ye,{event:x,variant:"compact",badgeVariant:r,onClick:d,disablePopover:!!d&&!l,renderPopover:l,showTime:!1,enableDrag:!0,...g?.eventCardCompact&&{className:g.eventCardCompact}})},x.id)),c&&p==="expand"&&e.jsxs("button",{type:"button",onPointerDown:x=>x.stopPropagation(),onClick:x=>{x.stopPropagation();const M=document.querySelector(`[data-day-key="${L}"]`);W({date:m.date,events:_,rect:M?.getBoundingClientRect()??new DOMRect(window.innerWidth/2-180,window.innerHeight/2-240,0,0)})},className:a.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",g?.moreEventsIndicator),children:["+",_.length-fe," more"]}),c&&p==="popover"&&e.jsxs(ae,{open:z===L,onOpenChange:x=>S(x?L:null),children:[e.jsx(ie,{asChild:!0,children:e.jsxs("button",{type:"button",onPointerDown:x=>x.stopPropagation(),onClick:x=>{x.stopPropagation(),S(L)},className:a.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",g?.moreEventsIndicator),children:["+",_.length-fe," more"]})}),e.jsxs(se,{align:"start",side:"right",sideOffset:8,className:"w-72 max-h-80 overflow-y-auto p-2",onPointerDown:x=>x.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 pb-2 border-b",children:[e.jsx("span",{className:"text-sm font-medium",children:m.date.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[_.length," events"]})]}),e.jsx("div",{className:"space-y-1.5",children:_.map(x=>e.jsx("div",{children:C?C({event:x,variant:"compact"}):e.jsx(ye,{event:x,variant:"compact",badgeVariant:r,onClick:M=>{S(null),d?.(M)},disablePopover:!!d&&!l,renderPopover:l,showTime:!0})},x.id))})]})]}),c&&p==="dayView"&&e.jsxs("div",{onPointerDown:x=>{x.stopPropagation(),$(m.date)},className:a.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",g?.moreEventsIndicator),children:["+",_.length-fe," more"]})]}),f&&e.jsx(f,{date:m.date,events:_,isToday:B,isCurrentMonth:m.isCurrentMonth,isWeekend:w,view:"month"})]},L)})})]})}),e.jsx(gt,{isOpen:T!==null,onClose:()=>W(null),date:T?.date??new Date,events:T?.events??[],anchorRect:T?.rect??null,badgeVariant:r,onEventClick:d,renderEvent:C,renderPopover:l})]})}const Se=26,Ue=2,Ne=4;function Ke(t,n){const s=y.startOfDay(t);for(let d=0;d<n.length;d++){const h=n[d];if(h&&y.isSameDay(s,h))return d}const r=n[0];return r&&s<y.startOfDay(r)?-1:7}function wn(t){const n=[...t].sort((r,d)=>{const h=r.endCol-r.startCol,i=d.endCol-d.startCol;return i!==h?i-h:r.startCol-d.startCol}),s=[];return n.map(r=>{let d=-1;for(let i=0;i<s.length;i++){const b=s[i];if(!b)continue;let C=!0;for(let l=r.startCol;l<=r.endCol;l++)if(b[l]){C=!1;break}if(C){d=i;break}}d===-1&&(d=s.length,s.push(new Array(7).fill(!1)));const h=s[d];if(h)for(let i=r.startCol;i<=r.endCol;i++)h[i]=!0;return{...r,row:d}})}function vn({pe:t,onEventClick:n,disablePopover:s,renderPopover:r}){const[d,h]=o.useState(!1),i=re(t.event.color),b=o.useCallback(()=>{s&&n?n(t.event):s||h(!0)},[s,n,t.event]),C=o.useCallback(()=>{h(!1)},[]),l=e.jsxs("button",{type:"button",onClick:b,className:a.cn("inline-flex items-center gap-1 rounded text-[10px] font-medium transition-opacity hover:opacity-80 mx-0.5 overflow-hidden w-full","sm:text-xs",i.bg,i.text,t.event.isCanceled&&"opacity-60 line-through",t.continuesBefore&&"rounded-l-none -ml-0.5 pl-1",t.continuesAfter&&"rounded-r-none -mr-0.5 pr-1"),style:{height:Se,lineHeight:`${Se}px`,paddingLeft:t.continuesBefore?4:6,paddingRight:t.continuesAfter?4:6},children:[t.continuesBefore&&e.jsx("span",{className:"text-[9px] opacity-60 flex-shrink-0",children:"◂"}),e.jsx("span",{className:"truncate",children:t.event.title}),t.isSingleDayAllDay&&e.jsx("span",{className:"text-[9px] opacity-70 flex-shrink-0 hidden sm:inline",children:"All day"}),t.continuesAfter&&e.jsx("span",{className:"text-[9px] opacity-60 flex-shrink-0",children:"▸"})]}),j=e.jsx(ee,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.event.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t.event)})]})}),v={gridColumn:`${t.startCol+2} / ${t.endCol+3}`,gridRow:t.row+1};return s?e.jsx("div",{style:v,children:e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:l}),j]})}):e.jsx("div",{style:v,children:e.jsxs(ae,{open:d,onOpenChange:h,children:[e.jsx(ie,{asChild:!0,children:l}),e.jsx(se,{className:"w-80",children:r?r({event:t.event,onClose:C}):e.jsx(Nn,{event:t.event,onClose:C})})]})})}function Nn({event:t,onClose:n}){const s=re(t.color),r=t.isCanceled??!1;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:a.cn("size-4 rounded shrink-0 mt-0.5",s.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:a.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums",children:y.formatEventTimeDisplay(t)})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function kn({events:t,weekDays:n,hourColumnWidth:s,minDayColumnWidth:r,dayColumnWidths:d,onEventClick:h,disablePopover:i=!1,renderPopover:b,className:C}){const l=o.useMemo(()=>{if(t.length===0)return[];const f=t.map(z=>{const S=Ke(z.startDate,n),T=Ke(z.endDate,n),W=Math.max(0,S),q=Math.min(6,T);if(W>6||q<0)return null;const F=S<0,O=T>6,R=y.detectAllDayEvent(z)&&y.isSameDay(z.startDate,z.endDate);return{event:z,startCol:W,endCol:q,continuesBefore:F,continuesAfter:O,isSingleDayAllDay:R}}).filter(Boolean);return wn(f)},[t,n]);if(l.length===0)return null;const j=Math.max(...l.map(f=>f.row))+1,v=Math.min(j,Ne),u=j>Ne,g=u?l.filter(f=>f.row>=Ne).length:0,p=[`${s}px`,...d.map(f=>f>r?`${f}px`:`minmax(${r}px, 1fr)`)].join(" "),N=v*Se+(v-1)*Ue+8;return e.jsxs("div",{className:a.cn("ic-all-day-row border-b bg-muted/20 relative",C),style:{display:"grid",gridTemplateColumns:p,gridTemplateRows:`repeat(${v}, ${Se}px)`,gap:`${Ue}px 0`,paddingTop:4,paddingBottom:4,minHeight:N},children:[e.jsx("div",{className:"flex items-start justify-center pt-1 text-[10px] font-medium text-muted-foreground",style:{gridColumn:1,gridRow:`1 / span ${v}`},children:e.jsx("span",{className:"hidden sm:inline",children:"All day"})}),n.map((f,z)=>e.jsx("div",{className:"pointer-events-none border-r last:border-r-0",style:{gridColumn:z+2,gridRow:`1 / span ${v}`}},f.toDateString())),l.filter(f=>f.row<Ne).map(f=>e.jsx(vn,{pe:f,onEventClick:h,disablePopover:i,renderPopover:b},f.event.id)),u&&e.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium px-2 flex items-center",style:{gridColumn:`2 / ${n.length+2}`,gridRow:v},children:["+",g," more"]})]})}const de=96,ge=56,Xe=72,Q=120,ke=100,Dn=3;function Cn({events:t,date:n,weekStartsOn:s=1,visibleHours:r={startHour:0,endHour:24},workingHours:d,slotDuration:h=30,badgeVariant:i="colored",onEventClick:b,onSlotSelect:C,onDayClick:l,className:j,renderEvent:v,renderPopover:u,slots:g,classNames:p}){const N=60/h,f=100/N,z=o.useMemo(()=>{const c=[];for(let x=0;x<N;x++)c.push(x*h);return c},[N,h]),S=o.useMemo(()=>y.getWeekDays(n,s),[n,s]),T=o.useMemo(()=>y.getVisibleHoursArray(r),[r]),W=o.useMemo(()=>{const c=new Map;for(const x of S){const M=x.toDateString(),D=y.getEventsForDay(t,x),{singleDay:H,multiDay:Y}=y.separateEventsByDuration(D),E=y.calculateOverlappingPositions(H,x,r,de),P=new Map;let Z=1;for(const X of E)if(P.set(X.event.id,X.position),X.position.width>0){const J=Math.round(100/X.position.width);Z=Math.max(Z,J)}c.set(M,{singleDay:H,multiDay:Y,positions:P,maxOverlapping:Z})}return c},[S,t,r]),q=o.useMemo(()=>{const c=new Map;for(const{multiDay:x}of W.values())for(const M of x)c.set(M.id,M);return Array.from(c.values())},[W]),F=new Date,O=S.findIndex(c=>y.isToday(c)),A=o.useMemo(()=>{if(O<0)return-1;const c=F.getHours()+F.getMinutes()/60;return c<r.startHour||c>r.endHour?-1:(c-r.startHour)*de},[O,r,F]),R=o.useRef(null);o.useLayoutEffect(()=>{const c=R.current;if(!c)return;const x=()=>{let M;if(O!==-1){const H=new Date().getHours();M=Math.max(H-1,r.startHour)}else{const Y=new Date().getDay();let E=d?.[Y];if(!E?.enabled||E.from===0){const P=d?.[1];P?.enabled&&(E=P)}E?.enabled&&E.from>0?M=Math.max(E.from-1,r.startHour):M=Math.max(7,r.startHour)}const D=(M-r.startHour)*de;c.scrollTo({top:D,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(x)})},[n,d,r,O]);const I=oe.useOptionalSlotSelection(),$=o.useCallback(c=>{I?.startSelection(c)},[I]),k=o.useCallback(c=>{I?.updateSelection(c)},[I]),m=o.useCallback(()=>{I?.endSelection()},[I]),L=o.useCallback(c=>{b?.(c)},[b]),_=ge+7*Q,B=o.useMemo(()=>{const c=[];for(const x of S){const M=x.toDateString(),H=W.get(M)?.maxOverlapping??1;H>Dn?c.push(Math.max(Q,H*ke)):c.push(Q)}return c},[S,W]),w=ge+B.reduce((c,x)=>c+x,0);return e.jsxs("div",{className:a.cn("ic-week-view flex flex-col h-full",j),children:[q.length>0&&e.jsx(kn,{events:q,weekDays:S,hourColumnWidth:ge,minDayColumnWidth:Q,dayColumnWidths:B,onEventClick:L,disablePopover:!!b&&!u,renderPopover:u,...p?.multiDayBanner&&{className:p.multiDayBanner}}),e.jsx("div",{ref:R,className:a.cn("ic-week-scroll-container flex-1",p?.scrollContainer),children:e.jsxs("div",{style:{minWidth:Math.max(_,w)},children:[e.jsx("div",{className:"ic-week-header sticky top-0 z-20 border-b bg-background",children:e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex-shrink-0 flex items-end justify-center pb-2 text-[10px] text-muted-foreground/70",style:{width:ge,height:Xe},children:e.jsxs("span",{className:"hidden sm:inline",children:["GMT",(()=>{const c=new Date().getTimezoneOffset(),x=Math.abs(Math.floor(c/60)),M=c<=0?"+":"-";return x>0?`${M}${String(x).padStart(2,"0")}`:""})()]})}),S.map((c,x)=>{const M=y.isToday(c),D=B[x]??Q,H=D>Q;return e.jsxs("div",{className:a.cn("flex-1 flex flex-col items-center justify-center border-r last:border-r-0 py-2",p?.columnHeader,M&&p?.columnHeaderToday),style:{height:Xe,minWidth:H?D:Q},children:[e.jsx("span",{className:a.cn("text-[11px] font-medium uppercase tracking-wide",M?"text-primary":"text-muted-foreground"),children:c.toLocaleDateString([],{weekday:"short"})}),e.jsx("button",{type:"button",onClick:()=>l?.(c),className:a.cn("flex items-center justify-center rounded-full transition-colors mt-0.5","size-10 text-2xl font-normal",M?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"),children:c.getDate()})]},c.toDateString())})]})}),e.jsxs("div",{className:"relative flex",children:[e.jsx("div",{className:a.cn("ic-hour-column sticky left-0 z-10 bg-zinc-50 border-r",p?.timeGutter),style:{width:ge},children:T.map((c,x)=>e.jsx("div",{className:"relative",style:{height:de},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:x!==0&&e.jsx("span",{className:a.cn("text-[10px] sm:text-xs text-muted-foreground",p?.timeGutterLabel),children:y.formatHourLabel(c)})})},c))}),e.jsx("div",{className:"ic-week-grid relative flex-1",children:e.jsx("div",{className:"flex divide-x",children:S.map((c,x)=>{const M=c.toDateString(),D=W.get(M),H=B[x]??Q,Y=H>Q;return e.jsxs("div",{className:"ic-day-column relative flex-1",style:{minWidth:Y?H:Q},children:[T.map((E,P)=>{const X=!y.isWorkingHour(c,E,d);return e.jsxs("div",{className:a.cn("relative",X&&"bg-calendar-disabled-hour",y.isToday(c)&&!X&&"bg-primary/5",p?.timeSlot,X?p?.timeSlotNonWorking:p?.timeSlotWorking),style:{height:de},children:[P!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),z.slice(1).map(J=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${J/60*100}%`}},J)),z.map((J,xe)=>{const me={date:c,hour:E,minute:J};return e.jsx(Oe,{slot:me,onSelectionStart:$,onSelectionMove:k,onSelectionEnd:m,isSelected:I?.isSlotSelected(me)??!1,isSelecting:I?.isSelecting??!1,disabled:X,className:"absolute inset-x-0",style:{top:`${xe*f}%`,height:`${f}%`},ariaLabel:`Add event on ${c.toLocaleDateString()} at ${y.formatHourLabel(E)}:${String(J).padStart(2,"0")}`},J)})]},E)}),D?.singleDay.map(E=>{const P=D.positions.get(E.id);if(!P)return null;const Z=`calc(${P.width}% - 2px)`,X=`max(${ke}px, ${Z})`;return v?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${P.top}px`,left:`${P.left}%`,width:X,minWidth:`${ke}px`},children:v({event:E,position:P})},E.id):e.jsx(He,{event:E,position:{top:P.top,left:P.left,width:P.width,minWidth:ke},hourHeight:de,badgeVariant:i,onClick:b,disablePopover:!!b&&!u,renderPopover:u,className:a.cn("pointer-events-auto",p?.eventCard)},E.id)}),x===O&&A>=0&&e.jsxs("div",{className:a.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",p?.currentTimeIndicator),style:{top:A},children:[e.jsx("div",{className:"h-2 w-2 -ml-1 rounded-full bg-red-500"}),e.jsx("div",{className:"flex-1 h-0.5 bg-red-500"})]})]},c.toDateString())})})})]})]})})]})}exports.AgendaView=mn;exports.Badge=ht;exports.Button=le;exports.CalendarHeader=xn;exports.DateNavigator=pt;exports.DayEventsExpansion=gt;exports.DaySlot=jt;exports.DayView=gn;exports.Dialog=Ze;exports.DialogClose=It;exports.DialogContent=_e;exports.DialogDescription=st;exports.DialogHeader=tt;exports.DialogTitle=nt;exports.DialogTrigger=Qe;exports.DropdownMenu=ze;exports.DropdownMenuContent=De;exports.DropdownMenuItem=Ce;exports.DropdownMenuTrigger=Le;exports.EventBlock=He;exports.EventCard=ye;exports.MonthView=jn;exports.MultiDayBanner=yt;exports.MultiDayEventBar=qt;exports.Popover=ae;exports.PopoverAnchor=Ht;exports.PopoverContent=se;exports.PopoverTrigger=ie;exports.Sheet=rt;exports.SheetClose=Ot;exports.SheetContent=We;exports.SheetDescription=dt;exports.SheetHeader=it;exports.SheetTitle=lt;exports.SheetTrigger=ot;exports.TimeSlot=Oe;exports.TodayButton=ft;exports.Tooltip=te;exports.TooltipContent=ee;exports.TooltipProvider=Pt;exports.TooltipTrigger=ne;exports.WeekView=Cn;exports.buttonVariants=mt;exports.getEventColorClasses=re;
11
+ //# sourceMappingURL=week-view-C1Vu2ErD.cjs.map