@innosolutions/inno-calendar 1.0.48 → 1.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agenda-widget-B-AVTnqM.cjs +2 -0
- package/dist/agenda-widget-B-AVTnqM.cjs.map +1 -0
- package/dist/{agenda-widget-DzXBzBfm.js → agenda-widget-DhCPt2vI.js} +941 -929
- package/dist/agenda-widget-DhCPt2vI.js.map +1 -0
- package/dist/components/event/event-card.d.ts.map +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/components/inno-calendar.d.ts +11 -0
- package/dist/components/inno-calendar.d.ts.map +1 -1
- package/dist/core/context/inno-calendar-provider.d.ts +15 -1
- package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.mjs +43 -43
- package/dist/core/types.d.ts +12 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +62 -62
- package/dist/presets/index.cjs +1 -1
- package/dist/presets/index.mjs +1 -1
- package/dist/slot-selection-context-BCsC7WT7.cjs +2 -0
- package/dist/slot-selection-context-BCsC7WT7.cjs.map +1 -0
- package/dist/slot-selection-context-D1495hEJ.js +595 -0
- package/dist/slot-selection-context-D1495hEJ.js.map +1 -0
- package/dist/{tailwind-calendar-Ba5BO9tj.js → tailwind-calendar-BmJa4HhQ.js} +2 -2
- package/dist/{tailwind-calendar-Ba5BO9tj.js.map → tailwind-calendar-BmJa4HhQ.js.map} +1 -1
- package/dist/{tailwind-calendar-4FkVdxbr.cjs → tailwind-calendar-CJmOutn1.cjs} +2 -2
- package/dist/{tailwind-calendar-4FkVdxbr.cjs.map → tailwind-calendar-CJmOutn1.cjs.map} +1 -1
- package/dist/use-calendar-BEuelmSu.cjs +2 -0
- package/dist/use-calendar-BEuelmSu.cjs.map +1 -0
- package/dist/use-calendar-Clo9DFK4.js +175 -0
- package/dist/use-calendar-Clo9DFK4.js.map +1 -0
- package/dist/{use-slot-selection-BJHlyfxL.js → use-slot-selection-BCZKnZSM.js} +2 -2
- package/dist/{use-slot-selection-BJHlyfxL.js.map → use-slot-selection-BCZKnZSM.js.map} +1 -1
- package/dist/{use-slot-selection-CTFC2-xS.cjs → use-slot-selection-Bwqwjiaq.cjs} +2 -2
- package/dist/{use-slot-selection-CTFC2-xS.cjs.map → use-slot-selection-Bwqwjiaq.cjs.map} +1 -1
- package/dist/week-view-D19YRBQC.cjs +11 -0
- package/dist/week-view-D19YRBQC.cjs.map +1 -0
- package/dist/{week-view-CVbu7Qh2.js → week-view-aRPB2cjn.js} +934 -916
- package/dist/week-view-aRPB2cjn.js.map +1 -0
- package/package.json +1 -1
- package/dist/agenda-widget-D_DbVHjB.cjs +0 -2
- package/dist/agenda-widget-D_DbVHjB.cjs.map +0 -1
- package/dist/agenda-widget-DzXBzBfm.js.map +0 -1
- package/dist/slot-selection-context-Bx3FKJfR.cjs +0 -2
- package/dist/slot-selection-context-Bx3FKJfR.cjs.map +0 -1
- package/dist/slot-selection-context-D2eu2o-7.js +0 -203
- package/dist/slot-selection-context-D2eu2o-7.js.map +0 -1
- package/dist/use-calendar-DR2emWYC.js +0 -555
- package/dist/use-calendar-DR2emWYC.js.map +0 -1
- package/dist/use-calendar-DR89bZu5.cjs +0 -2
- package/dist/use-calendar-DR89bZu5.cjs.map +0 -1
- package/dist/week-view-7r6Vhahg.cjs +0 -11
- package/dist/week-view-7r6Vhahg.cjs.map +0 -1
- package/dist/week-view-CVbu7Qh2.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-calendar-DR2emWYC.js","sources":["../src/core/context/calendar-context.tsx","../src/core/preferences/types.ts","../src/core/preferences/use-preferences.ts","../src/core/context/inno-calendar-provider.tsx","../src/core/hooks/use-calendar.ts"],"sourcesContent":["/**\n * CalendarContext - React Context for Calendar State\n *\n * Provides calendar state to deeply nested components without prop drilling.\n */\n\nimport { createContext, type ReactNode, useContext } from 'react';\nimport type { UseCalendarReturn } from '../hooks/use-calendar';\n\n// ============================================================================\n// CONTEXT\n// ============================================================================\n\n/**\n * Calendar context type - generic to support any event data type\n * We use `any` here because context consumers may not know the exact type\n * Use the typed hooks below for type-safe access\n */\n// biome-ignore lint/suspicious/noExplicitAny: Context needs to be flexible for different event types\nconst CalendarContext = createContext<UseCalendarReturn<any, any, any> | undefined>(undefined);\n\n// ============================================================================\n// PROVIDER\n// ============================================================================\n\nexport interface CalendarProviderProps<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\tchildren: ReactNode;\n\tvalue: UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData>;\n}\n\nexport function CalendarProvider<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>({ children, value }: CalendarProviderProps<TEventData, TScheduleTypeData, TResourceData>) {\n\treturn <CalendarContext.Provider value={value}>{children}</CalendarContext.Provider>;\n}\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Get the full calendar context (throws if not in provider)\n */\nexport function useCalendarContext<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> {\n\tconst context = useContext(CalendarContext);\n\tif (!context) {\n\t\tthrow new Error('useCalendarContext must be used within a CalendarProvider');\n\t}\n\treturn context as UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData>;\n}\n\n/**\n * Get the calendar context or undefined (safe version)\n */\nexport function useOptionalCalendarContext<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> | undefined {\n\tconst context = useContext(CalendarContext);\n\treturn context as UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> | undefined;\n}\n\n// ============================================================================\n// CONVENIENCE HOOKS\n// ============================================================================\n\n/**\n * Get current view\n */\nexport function useCalendarView() {\n\tconst { view, setView } = useCalendarContext();\n\treturn { view, setView };\n}\n\n/**\n * Get current date and navigation\n */\nexport function useCalendarDate() {\n\tconst { currentDate, setCurrentDate, goToNext, goToPrev, goToToday, goToDate } =\n\t\tuseCalendarContext();\n\treturn { currentDate, setCurrentDate, goToNext, goToPrev, goToToday, goToDate };\n}\n\n/**\n * Get filtered events\n */\nexport function useCalendarEvents<TEventData = Record<string, unknown>>() {\n\tconst { events, filteredEvents } = useCalendarContext<TEventData>();\n\treturn { events, filteredEvents };\n}\n\n/**\n * Get filters\n */\nexport function useCalendarFilters() {\n\tconst { filters, setFilters, updateFilters, clearFilters } = useCalendarContext();\n\treturn { filters, setFilters, updateFilters, clearFilters };\n}\n\n/**\n * Get preferences\n */\nexport function useCalendarPreferences() {\n\tconst { preferences, setPreferences } = useCalendarContext();\n\treturn { preferences, setPreferences };\n}\n\n// ============================================================================\n// ALIASES (for agenda-v2 naming convention compatibility)\n// ============================================================================\n\n/**\n * Alias for useCalendarContext - matches agenda-v2 naming convention\n */\nexport { useCalendarContext as useCalendar };\n\n/**\n * Alias for useOptionalCalendarContext - matches agenda-v2 naming convention\n */\nexport { useOptionalCalendarContext as useOptionalCalendar };\n","/**\n * Calendar Preferences Types\n *\n * Type definitions for the calendar preferences system.\n * This module enables:\n * - Persistent user preferences via localStorage\n * - Developer-controlled defaults and overrides\n * - Locking preferences to prevent user modifications\n * - Complete customization for different deployment scenarios\n */\n\nimport type { TBadgeVariant, TCalendarView, TSlotDuration } from '../types';\n\n// ============================================================================\n// PREFERENCE KEYS\n// ============================================================================\n\n/**\n * All available preference keys\n */\nexport type TPreferenceKey =\n\t| 'view'\n\t| 'badgeVariant'\n\t| 'slotDuration'\n\t| 'visibleHours'\n\t| 'workingHours'\n\t| 'showWorkingHoursOnly'\n\t| 'showWeekends'\n\t| 'firstDayOfWeek';\n\n/**\n * Storage key for localStorage\n */\nexport const PREFERENCES_STORAGE_KEY = 'inno-calendar-preferences';\n\n// ============================================================================\n// PREFERENCE VALUE TYPES\n// ============================================================================\n\n/**\n * Visible hours configuration\n */\nexport interface IVisibleHoursConfig {\n\tfrom: number;\n\tto: number;\n}\n\n/**\n * Working hours configuration per day of week\n * Key: 0 = Sunday, 1 = Monday, ..., 6 = Saturday\n */\nexport type TWorkingHoursConfig = {\n\t[dayIndex: number]: { from: number; to: number };\n};\n\n// ============================================================================\n// PREFERENCE VALUES\n// ============================================================================\n\n/**\n * Complete preferences object structure\n */\nexport interface IPreferences {\n\t/** Default calendar view */\n\tview: TCalendarView;\n\t/** Event badge display style */\n\tbadgeVariant: TBadgeVariant;\n\t/** Time slot duration in minutes (15, 30, 60) */\n\tslotDuration: TSlotDuration;\n\t/** Visible hours range for day/week views */\n\tvisibleHours: IVisibleHoursConfig;\n\t/** Working hours configuration per day */\n\tworkingHours: TWorkingHoursConfig;\n\t/** Show only working hours in day/week views */\n\tshowWorkingHoursOnly: boolean;\n\t/** Show weekend days */\n\tshowWeekends: boolean;\n\t/** First day of week (0 = Sunday, 1 = Monday, etc.) */\n\tfirstDayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n}\n\n/**\n * Partial preferences for updates\n */\nexport type TPartialPreferences = Partial<IPreferences>;\n\n// ============================================================================\n// PREFERENCE CONTROL\n// ============================================================================\n\n/**\n * Control mode for each preference\n * - 'user': User can modify, persisted to localStorage\n * - 'locked': Developer-controlled, cannot be modified by user\n * - 'session': User can modify during session, not persisted\n */\nexport type TPreferenceMode = 'user' | 'locked' | 'session';\n\n/**\n * Configuration for preference control\n * Allows developers to lock certain preferences to specific values\n */\nexport type TPreferenceModes = {\n\t[K in TPreferenceKey]?: TPreferenceMode;\n};\n\n/**\n * Locked values for preferences\n * When a preference mode is 'locked', this value is used\n */\nexport type TLockedPreferences = TPartialPreferences;\n\n// ============================================================================\n// PREFERENCES CONFIG\n// ============================================================================\n\n/**\n * Complete preferences configuration for developers\n *\n * @example\n * // Allow all preferences to be user-controlled (default)\n * const config: IPreferencesConfig = {};\n *\n * @example\n * // Lock slot duration to 30 minutes, let users control the rest\n * const config: IPreferencesConfig = {\n * modes: { slotDuration: 'locked' },\n * locked: { slotDuration: 30 }\n * };\n *\n * @example\n * // Completely override all preferences (no user control)\n * const config: IPreferencesConfig = {\n * modes: {\n * view: 'locked',\n * badgeVariant: 'locked',\n * slotDuration: 'locked',\n * visibleHours: 'locked',\n * workingHours: 'locked',\n * showWorkingHoursOnly: 'locked'\n * },\n * locked: {\n * view: 'week',\n * badgeVariant: 'colored',\n * slotDuration: 30,\n * visibleHours: { from: 8, to: 18 },\n * workingHours: { ... },\n * showWorkingHoursOnly: true\n * }\n * };\n */\nexport interface IPreferencesConfig {\n\t/**\n\t * Control mode for each preference\n\t * Defaults to 'user' for all preferences\n\t */\n\tmodes?: TPreferenceModes;\n\n\t/**\n\t * Values to use when preference mode is 'locked'\n\t */\n\tlocked?: TLockedPreferences;\n\n\t/**\n\t * Custom default values (used when no stored preference exists)\n\t * These override the system defaults\n\t */\n\tdefaults?: TPartialPreferences;\n\n\t/**\n\t * Custom localStorage key (default: 'inno-calendar-preferences')\n\t * Useful when multiple calendar instances need separate storage\n\t */\n\tstorageKey?: string;\n\n\t/**\n\t * Disable localStorage entirely\n\t * All preferences will reset on page reload\n\t */\n\tdisableStorage?: boolean;\n}\n\n// ============================================================================\n// HOOK RETURN TYPE\n// ============================================================================\n\n/**\n * Return type for useCalendarPreferences hook\n */\nexport interface IUsePreferencesReturn {\n\t/** Current preference values */\n\tpreferences: IPreferences;\n\n\t/** Update a single preference */\n\tsetPreference: <K extends TPreferenceKey>(key: K, value: IPreferences[K]) => void;\n\n\t/** Update multiple preferences at once */\n\tsetPreferences: (updates: TPartialPreferences) => void;\n\n\t/** Reset preferences to defaults */\n\tresetPreferences: () => void;\n\n\t/** Reset a single preference to default */\n\tresetPreference: (key: TPreferenceKey) => void;\n\n\t/** Check if a preference is locked */\n\tisLocked: (key: TPreferenceKey) => boolean;\n\n\t/** Check if a preference is persisted */\n\tisPersisted: (key: TPreferenceKey) => boolean;\n\n\t/** Get the mode for a preference */\n\tgetMode: (key: TPreferenceKey) => TPreferenceMode;\n}\n","/**\n * Calendar Preferences Hook\n *\n * Manages calendar preferences with localStorage persistence and developer control.\n *\n * Features:\n * - Automatic localStorage persistence\n * - Developer-controlled defaults and overrides\n * - Preference locking for controlled deployments\n * - Session-only preferences that don't persist\n * - Type-safe preference access and updates\n *\n * @example Basic usage\n * ```tsx\n * const { preferences, setPreference } = useCalendarPreferences();\n * setPreference('slotDuration', 30);\n * ```\n *\n * @example With developer configuration\n * ```tsx\n * const { preferences } = useCalendarPreferences({\n * modes: { slotDuration: 'locked' },\n * locked: { slotDuration: 60 },\n * defaults: { view: 'week' }\n * });\n * ```\n */\n\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport type { TWorkingHours } from '../types';\nimport {\n\ttype IPreferences,\n\ttype IPreferencesConfig,\n\ttype IUsePreferencesReturn,\n\tPREFERENCES_STORAGE_KEY,\n\ttype TPartialPreferences,\n\ttype TPreferenceKey,\n\ttype TPreferenceMode,\n} from './types';\n\n// ============================================================================\n// SYSTEM DEFAULTS\n// ============================================================================\n\n/**\n * Default visible hours\n */\nexport const DEFAULT_VISIBLE_HOURS = {\n\tfrom: 0,\n\tto: 24,\n};\n\n/**\n * Default working hours (Monday-Friday, 8am-6pm)\n */\nexport const DEFAULT_WORKING_HOURS: TWorkingHours = {\n\t0: { enabled: false, from: 8, to: 18 }, // Sunday - disabled\n\t1: { enabled: true, from: 8, to: 18 }, // Monday\n\t2: { enabled: true, from: 8, to: 18 }, // Tuesday\n\t3: { enabled: true, from: 8, to: 18 }, // Wednesday\n\t4: { enabled: true, from: 8, to: 18 }, // Thursday\n\t5: { enabled: true, from: 8, to: 18 }, // Friday\n\t6: { enabled: false, from: 8, to: 18 }, // Saturday - disabled\n};\n\n/**\n * Default slot duration in minutes\n */\nexport const DEFAULT_SLOT_DURATION = 30;\n\n/**\n * System default preferences\n * These are used when no stored preference or custom default exists\n */\nconst SYSTEM_DEFAULTS: IPreferences = {\n\tview: 'month',\n\tbadgeVariant: 'colored',\n\tslotDuration: DEFAULT_SLOT_DURATION,\n\tvisibleHours: DEFAULT_VISIBLE_HOURS,\n\tworkingHours: DEFAULT_WORKING_HOURS,\n\tshowWorkingHoursOnly: false,\n\tshowWeekends: true,\n\tfirstDayOfWeek: 1,\n};\n\n// ============================================================================\n// STORAGE HELPERS\n// ============================================================================\n\n/**\n * Load preferences from localStorage\n */\nfunction loadFromStorage(key: string): TPartialPreferences {\n\tif (typeof window === 'undefined') return {};\n\n\ttry {\n\t\tconst stored = localStorage.getItem(key);\n\t\tif (!stored) return {};\n\n\t\tconst parsed = JSON.parse(stored);\n\n\t\t// Validate and sanitize stored values\n\t\tconst sanitized: TPartialPreferences = {};\n\n\t\tif (parsed.view && typeof parsed.view === 'string') {\n\t\t\tsanitized.view = parsed.view;\n\t\t}\n\n\t\tif (parsed.badgeVariant && typeof parsed.badgeVariant === 'string') {\n\t\t\tsanitized.badgeVariant = parsed.badgeVariant;\n\t\t}\n\n\t\tif (parsed.slotDuration && typeof parsed.slotDuration === 'number') {\n\t\t\tsanitized.slotDuration = parsed.slotDuration;\n\t\t}\n\n\t\tif (parsed.visibleHours && typeof parsed.visibleHours === 'object') {\n\t\t\tsanitized.visibleHours = parsed.visibleHours;\n\t\t}\n\n\t\tif (parsed.workingHours && typeof parsed.workingHours === 'object') {\n\t\t\tsanitized.workingHours = parsed.workingHours;\n\t\t}\n\n\t\tif (typeof parsed.showWorkingHoursOnly === 'boolean') {\n\t\t\tsanitized.showWorkingHoursOnly = parsed.showWorkingHoursOnly;\n\t\t}\n\n\t\tif (typeof parsed.showWeekends === 'boolean') {\n\t\t\tsanitized.showWeekends = parsed.showWeekends;\n\t\t}\n\n\t\tif (typeof parsed.firstDayOfWeek === 'number') {\n\t\t\tsanitized.firstDayOfWeek = parsed.firstDayOfWeek;\n\t\t}\n\n\t\treturn sanitized;\n\t} catch {\n\t\tconsole.warn('[InnoCalendar] Failed to load preferences from localStorage');\n\t\treturn {};\n\t}\n}\n\n/**\n * Save preferences to localStorage\n */\nfunction saveToStorage(key: string, preferences: TPartialPreferences): void {\n\tif (typeof window === 'undefined') return;\n\n\ttry {\n\t\tlocalStorage.setItem(key, JSON.stringify(preferences));\n\t} catch {\n\t\tconsole.warn('[InnoCalendar] Failed to save preferences to localStorage');\n\t}\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\n/**\n * Calendar preferences hook with localStorage persistence\n *\n * @param config - Optional configuration for preferences behavior\n * @returns Preferences state and control functions\n */\nexport function useCalendarPreferences(config: IPreferencesConfig = {}): IUsePreferencesReturn {\n\tconst {\n\t\tmodes = {},\n\t\tlocked = {},\n\t\tdefaults = {},\n\t\tstorageKey = PREFERENCES_STORAGE_KEY,\n\t\tdisableStorage = false,\n\t} = config;\n\n\t// Compute effective defaults (system + custom)\n\tconst effectiveDefaults = useMemo<IPreferences>(\n\t\t() => ({\n\t\t\t...SYSTEM_DEFAULTS,\n\t\t\t...defaults,\n\t\t}),\n\t\t[defaults]\n\t);\n\n\t// Initialize state with stored + defaults\n\tconst [storedPreferences, setStoredPreferences] = useState<TPartialPreferences>(() => {\n\t\tif (disableStorage) return {};\n\t\treturn loadFromStorage(storageKey);\n\t});\n\n\t// Session-only preferences (not persisted)\n\tconst [sessionPreferences, setSessionPreferences] = useState<TPartialPreferences>({});\n\n\t// Save to localStorage when stored preferences change\n\tuseEffect(() => {\n\t\tif (disableStorage) return;\n\t\tsaveToStorage(storageKey, storedPreferences);\n\t}, [storedPreferences, storageKey, disableStorage]);\n\n\t// Get mode for a preference\n\tconst getMode = useCallback(\n\t\t(key: TPreferenceKey): TPreferenceMode => {\n\t\t\treturn modes[key] ?? 'user';\n\t\t},\n\t\t[modes]\n\t);\n\n\t// Check if preference is locked\n\tconst isLocked = useCallback(\n\t\t(key: TPreferenceKey): boolean => {\n\t\t\treturn getMode(key) === 'locked';\n\t\t},\n\t\t[getMode]\n\t);\n\n\t// Check if preference is persisted\n\tconst isPersisted = useCallback(\n\t\t(key: TPreferenceKey): boolean => {\n\t\t\tconst mode = getMode(key);\n\t\t\treturn mode === 'user' && !disableStorage;\n\t\t},\n\t\t[getMode, disableStorage]\n\t);\n\n\t// Compute final preferences (locked > session > stored > defaults)\n\tconst preferences = useMemo<IPreferences>(() => {\n\t\tconst result = { ...effectiveDefaults };\n\n\t\t// Apply stored preferences (for 'user' mode)\n\t\tfor (const key of Object.keys(result) as TPreferenceKey[]) {\n\t\t\tconst mode = getMode(key);\n\n\t\t\tif (mode === 'locked' && key in locked) {\n\t\t\t\t// Use locked value\n\t\t\t\t(result as Record<string, unknown>)[key] = locked[key];\n\t\t\t} else if (mode === 'session' && key in sessionPreferences) {\n\t\t\t\t// Use session value\n\t\t\t\t(result as Record<string, unknown>)[key] = sessionPreferences[key];\n\t\t\t} else if (mode === 'user' && key in storedPreferences) {\n\t\t\t\t// Use stored value\n\t\t\t\t(result as Record<string, unknown>)[key] = storedPreferences[key];\n\t\t\t}\n\t\t\t// Otherwise, keep default\n\t\t}\n\n\t\treturn result;\n\t}, [effectiveDefaults, storedPreferences, sessionPreferences, locked, getMode]);\n\n\t// Set a single preference\n\tconst setPreference = useCallback(\n\t\t<K extends TPreferenceKey>(key: K, value: IPreferences[K]) => {\n\t\t\tconst mode = getMode(key);\n\n\t\t\t// Can't modify locked preferences\n\t\t\tif (mode === 'locked') {\n\t\t\t\tconsole.warn(`[InnoCalendar] Preference \"${key}\" is locked and cannot be modified`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mode === 'session') {\n\t\t\t\tsetSessionPreferences((prev) => ({ ...prev, [key]: value }));\n\t\t\t} else {\n\t\t\t\tsetStoredPreferences((prev) => ({ ...prev, [key]: value }));\n\t\t\t}\n\t\t},\n\t\t[getMode]\n\t);\n\n\t// Set multiple preferences at once\n\tconst setPreferences = useCallback(\n\t\t(updates: TPartialPreferences) => {\n\t\t\tconst sessionUpdates: TPartialPreferences = {};\n\t\t\tconst storedUpdates: TPartialPreferences = {};\n\n\t\t\tfor (const key of Object.keys(updates) as TPreferenceKey[]) {\n\t\t\t\tconst mode = getMode(key);\n\t\t\t\tconst value = updates[key];\n\n\t\t\t\tif (value === undefined) continue;\n\n\t\t\t\tif (mode === 'locked') {\n\t\t\t\t\tconsole.warn(`[InnoCalendar] Preference \"${key}\" is locked and cannot be modified`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (mode === 'session') {\n\t\t\t\t\t(sessionUpdates as Record<string, unknown>)[key] = value;\n\t\t\t\t} else {\n\t\t\t\t\t(storedUpdates as Record<string, unknown>)[key] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (Object.keys(sessionUpdates).length > 0) {\n\t\t\t\tsetSessionPreferences((prev) => ({ ...prev, ...sessionUpdates }));\n\t\t\t}\n\n\t\t\tif (Object.keys(storedUpdates).length > 0) {\n\t\t\t\tsetStoredPreferences((prev) => ({ ...prev, ...storedUpdates }));\n\t\t\t}\n\t\t},\n\t\t[getMode]\n\t);\n\n\t// Reset all preferences to defaults\n\tconst resetPreferences = useCallback(() => {\n\t\tsetStoredPreferences({});\n\t\tsetSessionPreferences({});\n\n\t\tif (!disableStorage) {\n\t\t\tlocalStorage.removeItem(storageKey);\n\t\t}\n\t}, [storageKey, disableStorage]);\n\n\t// Reset a single preference to default\n\tconst resetPreference = useCallback(\n\t\t(key: TPreferenceKey) => {\n\t\t\tconst mode = getMode(key);\n\n\t\t\tif (mode === 'locked') {\n\t\t\t\tconsole.warn(`[InnoCalendar] Preference \"${key}\" is locked and cannot be reset`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mode === 'session') {\n\t\t\t\tsetSessionPreferences((prev) => {\n\t\t\t\t\tconst { [key]: _, ...rest } = prev;\n\t\t\t\t\treturn rest;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tsetStoredPreferences((prev) => {\n\t\t\t\t\tconst { [key]: _, ...rest } = prev;\n\t\t\t\t\treturn rest;\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[getMode]\n\t);\n\n\treturn {\n\t\tpreferences,\n\t\tsetPreference,\n\t\tsetPreferences,\n\t\tresetPreferences,\n\t\tresetPreference,\n\t\tisLocked,\n\t\tisPersisted,\n\t\tgetMode,\n\t};\n}\n\nexport default useCalendarPreferences;\n","/**\n * InnoCalendar Provider\n *\n * A CalendarProvider that matches agenda-v2's API exactly.\n * This is an all-in-one provider that manages state internally\n * rather than requiring consumers to use useCalendar separately.\n *\n * Features:\n * - Automatic preference persistence to localStorage\n * - Developer-controlled preference locking\n * - Same prop interface as agenda-v2's CalendarProvider\n * - Same context shape for component compatibility\n */\n\nimport {\n createContext,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport {\n type IPreferencesConfig,\n type TPreferenceKey,\n useCalendarPreferences,\n} from \"../preferences\";\nimport type {\n CalendarEvent,\n ICalendarUser,\n IScheduleType,\n TBadgeVariant,\n TCalendarView,\n TSlotDuration,\n TWorkingHours,\n} from \"../types\";\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\n// Re-export types from core/types for convenience\nexport type { IWorkingHoursDay, TSlotDuration, TWorkingHours } from \"../types\";\n\n/**\n * Visible hours configuration\n * Using start/end to match agenda-v2 naming\n */\nexport interface TVisibleHours {\n start: number;\n end: number;\n}\n\n// ============================================================================\n// CONTEXT INTERFACE - Matches agenda-v2 exactly\n// ============================================================================\n\nexport interface IInnoCalendarContext<TEventData = Record<string, unknown>> {\n // View & Navigation\n view: TCalendarView;\n setView: (view: TCalendarView) => void;\n selectedDate: Date;\n /** Set selected date. Pass optional forView to use that view for date range calculation. */\n setSelectedDate: (date: Date, forView?: TCalendarView) => void;\n\n // User/Participant Filtering\n selectedUserId: string | \"all\";\n setSelectedUserId: (userId: string | \"all\") => void;\n\n // Visual Customization\n badgeVariant: TBadgeVariant;\n setBadgeVariant: (variant: TBadgeVariant) => void;\n\n // Time Configuration\n workingHours: TWorkingHours;\n setWorkingHours: Dispatch<SetStateAction<TWorkingHours>>;\n visibleHours: TVisibleHours;\n setVisibleHours: Dispatch<SetStateAction<TVisibleHours>>;\n showWorkingHoursOnly: boolean;\n setShowWorkingHoursOnly: (show: boolean) => void;\n slotDuration: TSlotDuration;\n setSlotDuration: (duration: TSlotDuration) => void;\n\n // Preferences\n /**\n * Check if a specific preference is locked by the developer.\n * Useful for conditionally disabling UI controls.\n */\n isPreferenceLocked: (key: TPreferenceKey) => boolean;\n\n // Data\n events: CalendarEvent<TEventData>[];\n setEvents: Dispatch<SetStateAction<CalendarEvent<TEventData>[]>>;\n users: ICalendarUser[];\n scheduleTypes: IScheduleType[];\n\n // Filter state (schedule types)\n selectedScheduleTypeIds: number[];\n setSelectedScheduleTypeIds: Dispatch<SetStateAction<number[]>>;\n\n // Search\n searchQuery: string;\n setSearchQuery: (query: string) => void;\n\n // Computed / Filtered Events\n filteredEvents: CalendarEvent<TEventData>[];\n}\n\n// ============================================================================\n// CONTEXT\n// ============================================================================\n\n// biome-ignore lint/suspicious/noExplicitAny: Context needs flexibility for different event types\nconst InnoCalendarContext = createContext<\n IInnoCalendarContext<any> | undefined\n>(undefined);\n\n// ============================================================================\n// DEFAULT WORKING HOURS\n// ============================================================================\n\nconst DEFAULT_WORKING_HOURS: TWorkingHours = {\n 0: { enabled: false, from: 8, to: 17 }, // Sunday\n 1: { enabled: true, from: 8, to: 17 }, // Monday\n 2: { enabled: true, from: 8, to: 17 }, // Tuesday\n 3: { enabled: true, from: 8, to: 17 }, // Wednesday\n 4: { enabled: true, from: 8, to: 17 }, // Thursday\n 5: { enabled: true, from: 8, to: 17 }, // Friday\n 6: { enabled: true, from: 8, to: 12 }, // Saturday\n};\n\nconst DEFAULT_VISIBLE_HOURS: TVisibleHours = { start: 0, end: 24 };\n\n// ============================================================================\n// PROVIDER PROPS - Matches agenda-v2 exactly\n// ============================================================================\n\nexport interface InnoCalendarProviderProps<\n TEventData = Record<string, unknown>,\n> {\n children: ReactNode;\n\n // Initial data from server/loader\n initialEvents?: CalendarEvent<TEventData>[];\n initialUsers?: ICalendarUser[];\n initialScheduleTypes?: IScheduleType[];\n\n // Initial filter state (from URL)\n initialView?: TCalendarView;\n initialDate?: Date;\n initialSelectedUserId?: string | \"all\";\n initialScheduleTypeIds?: number[];\n initialParticipantIds?: string[];\n initialWorkingHoursView?: \"default\" | \"enabled\" | \"disabled\";\n initialSearchQuery?: string;\n\n /**\n * Preferences configuration for developer control\n */\n preferencesConfig?: IPreferencesConfig;\n\n // Callbacks for parent sync\n onDateChange?: (date: Date, view: TCalendarView) => void;\n onViewChange?: (view: TCalendarView) => void;\n}\n\n// ============================================================================\n// PROVIDER COMPONENT\n// ============================================================================\n\nexport function InnoCalendarProvider<TEventData = Record<string, unknown>>({\n children,\n initialEvents = [],\n initialUsers = [],\n initialScheduleTypes = [],\n initialView,\n initialDate,\n initialSelectedUserId = \"all\",\n initialScheduleTypeIds = [],\n initialParticipantIds = [],\n initialWorkingHoursView = \"default\",\n initialSearchQuery = \"\",\n preferencesConfig,\n onDateChange,\n onViewChange,\n}: InnoCalendarProviderProps<TEventData>) {\n // ========================================================================\n // PREFERENCES (persisted to localStorage)\n // ========================================================================\n const { preferences, setPreference, isLocked } =\n useCalendarPreferences(preferencesConfig);\n\n // ========================================================================\n // VIEW & NAVIGATION\n // ========================================================================\n const [view, setViewInternal] = useState<TCalendarView>(\n initialView ?? (preferences.view as TCalendarView) ?? \"week\",\n );\n const [selectedDate, setSelectedDateInternal] = useState<Date>(\n initialDate ?? new Date(),\n );\n\n // User Filtering\n const [selectedUserId, setSelectedUserId] = useState<string | \"all\">(\n initialSelectedUserId,\n );\n\n // ========================================================================\n // PREFERENCE-BACKED STATE\n // ========================================================================\n const badgeVariant = (preferences.badgeVariant as TBadgeVariant) ?? \"colored\";\n const setBadgeVariant = useCallback(\n (variant: TBadgeVariant) => {\n if (!isLocked(\"badgeVariant\")) {\n setPreference(\"badgeVariant\", variant);\n }\n },\n [setPreference, isLocked],\n );\n\n const workingHours =\n (preferences.workingHours as TWorkingHours) ?? DEFAULT_WORKING_HOURS;\n const setWorkingHours: Dispatch<SetStateAction<TWorkingHours>> = useCallback(\n (action) => {\n if (!isLocked(\"workingHours\")) {\n const current =\n (preferences.workingHours as TWorkingHours) ?? DEFAULT_WORKING_HOURS;\n const newValue =\n typeof action === \"function\" ? action(current) : action;\n setPreference(\"workingHours\", newValue);\n }\n },\n [setPreference, isLocked, preferences.workingHours],\n );\n\n // Convert preferences format (from/to) to our format (start/end)\n const prefVisibleHours = preferences.visibleHours as\n | { from?: number; to?: number; start?: number; end?: number }\n | undefined;\n const visibleHours: TVisibleHours = useMemo(() => {\n if (!prefVisibleHours) return DEFAULT_VISIBLE_HOURS;\n // Handle both formats\n return {\n start: prefVisibleHours.start ?? prefVisibleHours.from ?? 0,\n end: prefVisibleHours.end ?? prefVisibleHours.to ?? 24,\n };\n }, [prefVisibleHours]);\n\n const setVisibleHours: Dispatch<SetStateAction<TVisibleHours>> = useCallback(\n (action) => {\n if (!isLocked(\"visibleHours\")) {\n const newValue =\n typeof action === \"function\" ? action(visibleHours) : action;\n // Store in preferences format (from/to)\n setPreference(\"visibleHours\", {\n from: newValue.start,\n to: newValue.end,\n });\n }\n },\n [setPreference, isLocked, visibleHours],\n );\n\n // showWorkingHoursOnly can be overridden by URL param\n const [showWorkingHoursOnlyState, setShowWorkingHoursOnlyState] = useState(\n initialWorkingHoursView === \"enabled\"\n ? true\n : initialWorkingHoursView === \"disabled\"\n ? false\n : ((preferences.showWorkingHoursOnly as boolean) ?? false),\n );\n const showWorkingHoursOnly = showWorkingHoursOnlyState;\n const setShowWorkingHoursOnly = useCallback(\n (show: boolean) => {\n setShowWorkingHoursOnlyState(show);\n if (!isLocked(\"showWorkingHoursOnly\")) {\n setPreference(\"showWorkingHoursOnly\", show);\n }\n },\n [setPreference, isLocked],\n );\n\n const slotDuration = (preferences.slotDuration as TSlotDuration) ?? 30;\n const setSlotDuration = useCallback(\n (duration: TSlotDuration) => {\n if (!isLocked(\"slotDuration\")) {\n setPreference(\"slotDuration\", duration);\n }\n },\n [setPreference, isLocked],\n );\n\n // ========================================================================\n // DATA\n // ========================================================================\n const [events, setEvents] =\n useState<CalendarEvent<TEventData>[]>(initialEvents);\n\n // Sync events when initialEvents changes (e.g., after navigation/refetch)\n useEffect(() => {\n setEvents(initialEvents);\n }, [initialEvents]);\n\n // Filter State\n const [selectedScheduleTypeIds, setSelectedScheduleTypeIds] = useState<\n number[]\n >(initialScheduleTypeIds);\n const [selectedParticipantIds, _setSelectedParticipantIds] = useState<\n string[]\n >(initialParticipantIds);\n\n // Search\n const [searchQuery, setSearchQuery] = useState(initialSearchQuery);\n\n // ========================================================================\n // VIEW & DATE SETTERS\n // ========================================================================\n const setView = useCallback(\n (newView: TCalendarView) => {\n setViewInternal(newView);\n if (!isLocked(\"view\")) {\n setPreference(\"view\", newView);\n }\n onViewChange?.(newView);\n },\n [onViewChange, setPreference, isLocked],\n );\n\n const setSelectedDate = useCallback(\n (newDate: Date, forView?: TCalendarView) => {\n setSelectedDateInternal(newDate);\n onDateChange?.(newDate, forView ?? view);\n },\n [onDateChange, view],\n );\n\n // ========================================================================\n // FILTERED EVENTS\n // ========================================================================\n const filteredEvents = useMemo(() => {\n let result = events;\n\n // Filter by schedule type\n if (selectedScheduleTypeIds.length > 0) {\n result = result.filter(\n (event) =>\n event.scheduleTypeId !== undefined &&\n selectedScheduleTypeIds.includes(event.scheduleTypeId),\n );\n }\n\n // Filter by participant\n if (selectedParticipantIds.length > 0) {\n result = result.filter((event) => {\n // Check participants array (includes primary user in this model)\n if (event.participants?.length) {\n return event.participants.some((p) =>\n selectedParticipantIds.includes(p.id),\n );\n }\n return false;\n });\n }\n\n // Filter by selected user (single user view)\n if (selectedUserId !== \"all\") {\n result = result.filter((event) =>\n event.participants?.some((p) => p.id === selectedUserId),\n );\n }\n\n // Filter by search query\n if (searchQuery.trim()) {\n const query = searchQuery.toLowerCase();\n result = result.filter(\n (event) =>\n event.title.toLowerCase().includes(query) ||\n event.description?.toLowerCase().includes(query) ||\n event.scheduleTypeName?.toLowerCase().includes(query) ||\n event.participants?.some((p) => p.name.toLowerCase().includes(query)),\n );\n }\n\n return result;\n }, [\n events,\n selectedScheduleTypeIds,\n selectedParticipantIds,\n selectedUserId,\n searchQuery,\n ]);\n\n // ========================================================================\n // CONTEXT VALUE\n // ========================================================================\n const value = useMemo<IInnoCalendarContext<TEventData>>(\n () => ({\n // View & Navigation\n view,\n setView,\n selectedDate,\n setSelectedDate,\n\n // User Filtering\n selectedUserId,\n setSelectedUserId,\n\n // Visual Customization\n badgeVariant,\n setBadgeVariant,\n\n // Time Configuration\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n slotDuration,\n setSlotDuration,\n\n // Preferences\n isPreferenceLocked: isLocked,\n\n // Data\n events,\n setEvents,\n users: initialUsers,\n scheduleTypes: initialScheduleTypes,\n\n // Filters\n selectedScheduleTypeIds,\n setSelectedScheduleTypeIds,\n\n // Search\n searchQuery,\n setSearchQuery,\n\n // Computed\n filteredEvents,\n }),\n [\n view,\n setView,\n selectedDate,\n setSelectedDate,\n selectedUserId,\n badgeVariant,\n setBadgeVariant,\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n slotDuration,\n setSlotDuration,\n isLocked,\n events,\n initialUsers,\n initialScheduleTypes,\n selectedScheduleTypeIds,\n searchQuery,\n filteredEvents,\n ],\n );\n\n return (\n <InnoCalendarContext.Provider value={value}>\n {children}\n </InnoCalendarContext.Provider>\n );\n}\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Get the full calendar context\n * This is the primary hook - use this in most components\n */\nexport function useInnoCalendar<\n TEventData = Record<string, unknown>,\n>(): IInnoCalendarContext<TEventData> {\n const context = useContext(InnoCalendarContext);\n if (!context) {\n throw new Error(\n \"useInnoCalendar must be used within an InnoCalendarProvider\",\n );\n }\n return context as IInnoCalendarContext<TEventData>;\n}\n\n/**\n * Optional calendar context hook\n */\nexport function useOptionalInnoCalendar<\n TEventData = Record<string, unknown>,\n>(): IInnoCalendarContext<TEventData> | undefined {\n return useContext(InnoCalendarContext) as\n | IInnoCalendarContext<TEventData>\n | undefined;\n}\n\n// ============================================================================\n// SELECTIVE HOOKS (for performance optimization)\n// ============================================================================\n\n/**\n * Access only view-related state\n */\nexport function useInnoCalendarView() {\n const { view, setView, selectedDate, setSelectedDate, slotDuration } =\n useInnoCalendar();\n return { view, setView, selectedDate, setSelectedDate, slotDuration };\n}\n\n/**\n * Access only events data\n */\nexport function useInnoCalendarEvents<TEventData = Record<string, unknown>>() {\n const { events, setEvents, filteredEvents } = useInnoCalendar<TEventData>();\n return { events, setEvents, filteredEvents };\n}\n\n/**\n * Access only filter state\n */\nexport function useInnoCalendarFilters() {\n const {\n selectedScheduleTypeIds,\n setSelectedScheduleTypeIds,\n selectedUserId,\n setSelectedUserId,\n searchQuery,\n setSearchQuery,\n } = useInnoCalendar();\n return {\n selectedScheduleTypeIds,\n setSelectedScheduleTypeIds,\n selectedUserId,\n setSelectedUserId,\n searchQuery,\n setSearchQuery,\n };\n}\n\n/**\n * Access only time configuration\n */\nexport function useInnoCalendarTimeConfig() {\n const {\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n } = useInnoCalendar();\n return {\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n };\n}\n","/**\n * useCalendar - Main Calendar Hook\n *\n * This hook provides all the state and methods needed to build a calendar.\n * It is fully generic, allowing consumers to define their own event data types.\n *\n * @example\n * ```tsx\n * interface MyEventData {\n * projectId: number;\n * priority: 'low' | 'medium' | 'high';\n * }\n *\n * const calendar = useCalendar<MyEventData>({\n * events: myEvents,\n * onEventClick: (event) => {\n * console.log(event.data?.projectId);\n * },\n * });\n * ```\n */\n\nimport { useCallback, useMemo, useState } from 'react';\nimport { DEFAULT_PREFERENCES } from '../constants';\nimport type {\n\tCalendarEvent,\n\tICalendarFilters,\n\tICalendarPreferences,\n\tIDateRange,\n\tIResource,\n\tIScheduleType,\n\tISelectionResult,\n\tTCalendarView,\n} from '../types';\nimport {\n\tfilterEventsByDateRange,\n\tfilterEventsByResource,\n\tfilterEventsByScheduleType,\n\tfilterEventsBySearch,\n\tfilterOutCanceled,\n\tsortEventsByStart,\n} from '../utils/event-utils';\nimport {\n\tgetViewDateRange,\n\tgetViewTitle,\n\tnavigateNext,\n\tnavigatePrev,\n\tnavigateToday,\n} from '../utils/grid-utils';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\n/**\n * Options for useCalendar hook\n */\nexport interface UseCalendarOptions<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\t/** Events to display */\n\tevents: CalendarEvent<TEventData>[];\n\n\t/** Available resources (for resource views) */\n\tresources?: IResource<TResourceData>[] | undefined;\n\n\t/** Available schedule types */\n\tscheduleTypes?: IScheduleType<TScheduleTypeData>[] | undefined;\n\n\t/** Initial view */\n\tinitialView?: TCalendarView | undefined;\n\n\t/** Initial date */\n\tinitialDate?: Date | undefined;\n\n\t/** Initial filters */\n\tinitialFilters?: ICalendarFilters | undefined;\n\n\t/** User preferences */\n\tpreferences?: Partial<ICalendarPreferences> | undefined;\n\n\t/** Locked preferences (cannot be changed by user) */\n\tlockedPreferences?: Partial<ICalendarPreferences> | undefined;\n\n\t/** Locale for formatting */\n\tlocale?: string | undefined;\n\n\t/** Callback when view changes */\n\tonViewChange?: ((view: TCalendarView) => void) | undefined;\n\n\t/** Callback when date changes */\n\tonDateChange?: ((date: Date) => void) | undefined;\n\n\t/** Callback when event is clicked */\n\tonEventClick?: ((event: CalendarEvent<TEventData>) => void) | undefined;\n\n\t/** Callback when slot is selected */\n\tonSlotSelect?: ((selection: ISelectionResult) => void) | undefined;\n\n\t/** Callback when filters change */\n\tonFiltersChange?: ((filters: ICalendarFilters) => void) | undefined;\n}\n\n/**\n * Return type for useCalendar hook\n */\nexport interface UseCalendarReturn<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\t// State\n\tview: TCalendarView;\n\tcurrentDate: Date;\n\tdateRange: IDateRange;\n\tfilters: ICalendarFilters;\n\tpreferences: ICalendarPreferences;\n\n\t// Computed\n\tfilteredEvents: CalendarEvent<TEventData>[];\n\tviewTitle: string;\n\n\t// Data\n\tevents: CalendarEvent<TEventData>[];\n\tresources: IResource<TResourceData>[];\n\tscheduleTypes: IScheduleType<TScheduleTypeData>[];\n\n\t// Actions\n\tsetView: (view: TCalendarView) => void;\n\tsetCurrentDate: (date: Date) => void;\n\tgoToNext: () => void;\n\tgoToPrev: () => void;\n\tgoToToday: () => void;\n\tgoToDate: (date: Date) => void;\n\n\t// Filters\n\tsetFilters: (filters: ICalendarFilters) => void;\n\tupdateFilters: (updates: Partial<ICalendarFilters>) => void;\n\tclearFilters: () => void;\n\n\t// Preferences\n\tsetPreferences: (prefs: Partial<ICalendarPreferences>) => void;\n\n\t// Event handlers\n\thandleEventClick: (event: CalendarEvent<TEventData>) => void;\n\thandleSlotSelect: (selection: ISelectionResult) => void;\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function useCalendar<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(\n\toptions: UseCalendarOptions<TEventData, TScheduleTypeData, TResourceData>\n): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> {\n\tconst {\n\t\tevents,\n\t\tresources = [],\n\t\tscheduleTypes = [],\n\t\tinitialView = 'week',\n\t\tinitialDate,\n\t\tinitialFilters = {},\n\t\tpreferences: userPreferences = {},\n\t\tlockedPreferences = {},\n\t\tlocale = 'en-US',\n\t\tonViewChange,\n\t\tonDateChange,\n\t\tonEventClick,\n\t\tonSlotSelect,\n\t\tonFiltersChange,\n\t} = options;\n\n\t// ========================================================================\n\t// STATE\n\t// ========================================================================\n\n\tconst [view, setViewState] = useState<TCalendarView>(initialView);\n\tconst [currentDate, setCurrentDateState] = useState<Date>(() => initialDate ?? new Date());\n\tconst [filters, setFiltersState] = useState<ICalendarFilters>(initialFilters);\n\tconst [preferences, setPreferencesState] = useState<ICalendarPreferences>(() => ({\n\t\t...DEFAULT_PREFERENCES,\n\t\t...userPreferences,\n\t\t...lockedPreferences,\n\t}));\n\n\t// ========================================================================\n\t// COMPUTED\n\t// ========================================================================\n\n\tconst dateRange = useMemo(\n\t\t() => getViewDateRange(currentDate, view, preferences.firstDayOfWeek),\n\t\t[currentDate, view, preferences.firstDayOfWeek]\n\t);\n\n\tconst viewTitle = useMemo(\n\t\t() => getViewTitle(currentDate, view, locale),\n\t\t[currentDate, view, locale]\n\t);\n\n\tconst filteredEvents = useMemo(() => {\n\t\tlet result = [...events];\n\n\t\t// Filter by date range\n\t\tresult = filterEventsByDateRange(result, dateRange.startDate, dateRange.endDate);\n\n\t\t// Filter by schedule types\n\t\tconst scheduleTypeIds = filters.scheduleTypeIds;\n\t\tif (scheduleTypeIds && scheduleTypeIds.length > 0) {\n\t\t\tresult = filterEventsByScheduleType(result, scheduleTypeIds);\n\t\t}\n\n\t\t// Filter by resources\n\t\tconst resourceIds = filters.resourceIds;\n\t\tif (resourceIds && resourceIds.length > 0) {\n\t\t\tresult = filterEventsByResource(result, resourceIds);\n\t\t}\n\n\t\t// Filter by search\n\t\tconst search = filters.search;\n\t\tif (search) {\n\t\t\tresult = filterEventsBySearch(result, search);\n\t\t}\n\n\t\t// Filter canceled\n\t\tif (!preferences.showCanceledEvents) {\n\t\t\tresult = filterOutCanceled(result);\n\t\t}\n\n\t\t// Sort by start date\n\t\treturn sortEventsByStart(result);\n\t}, [events, dateRange, filters, preferences.showCanceledEvents]);\n\n\t// ========================================================================\n\t// ACTIONS\n\t// ========================================================================\n\n\tconst setView = useCallback(\n\t\t(newView: TCalendarView) => {\n\t\t\tsetViewState(newView);\n\t\t\tonViewChange?.(newView);\n\t\t},\n\t\t[onViewChange]\n\t);\n\n\tconst setCurrentDate = useCallback(\n\t\t(date: Date) => {\n\t\t\tsetCurrentDateState(date);\n\t\t\tonDateChange?.(date);\n\t\t},\n\t\t[onDateChange]\n\t);\n\n\tconst goToNext = useCallback(() => {\n\t\tconst newDate = navigateNext(currentDate, view);\n\t\tsetCurrentDate(newDate);\n\t}, [currentDate, view, setCurrentDate]);\n\n\tconst goToPrev = useCallback(() => {\n\t\tconst newDate = navigatePrev(currentDate, view);\n\t\tsetCurrentDate(newDate);\n\t}, [currentDate, view, setCurrentDate]);\n\n\tconst goToToday = useCallback(() => {\n\t\tsetCurrentDate(navigateToday());\n\t}, [setCurrentDate]);\n\n\tconst goToDate = useCallback(\n\t\t(date: Date) => {\n\t\t\tsetCurrentDate(date);\n\t\t},\n\t\t[setCurrentDate]\n\t);\n\n\t// ========================================================================\n\t// FILTERS\n\t// ========================================================================\n\n\tconst setFilters = useCallback(\n\t\t(newFilters: ICalendarFilters) => {\n\t\t\tsetFiltersState(newFilters);\n\t\t\tonFiltersChange?.(newFilters);\n\t\t},\n\t\t[onFiltersChange]\n\t);\n\n\tconst updateFilters = useCallback(\n\t\t(updates: Partial<ICalendarFilters>) => {\n\t\t\tsetFiltersState((prev) => {\n\t\t\t\tconst next = { ...prev, ...updates };\n\t\t\t\tonFiltersChange?.(next);\n\t\t\t\treturn next;\n\t\t\t});\n\t\t},\n\t\t[onFiltersChange]\n\t);\n\n\tconst clearFilters = useCallback(() => {\n\t\tconst emptyFilters: ICalendarFilters = {};\n\t\tsetFiltersState(emptyFilters);\n\t\tonFiltersChange?.(emptyFilters);\n\t}, [onFiltersChange]);\n\n\t// ========================================================================\n\t// PREFERENCES\n\t// ========================================================================\n\n\tconst setPreferences = useCallback(\n\t\t(prefs: Partial<ICalendarPreferences>) => {\n\t\t\tsetPreferencesState((prev) => ({\n\t\t\t\t...prev,\n\t\t\t\t...prefs,\n\t\t\t\t...lockedPreferences, // Locked prefs always override\n\t\t\t}));\n\t\t},\n\t\t[lockedPreferences]\n\t);\n\n\t// ========================================================================\n\t// EVENT HANDLERS\n\t// ========================================================================\n\n\tconst handleEventClick = useCallback(\n\t\t(event: CalendarEvent<TEventData>) => {\n\t\t\tonEventClick?.(event);\n\t\t},\n\t\t[onEventClick]\n\t);\n\n\tconst handleSlotSelect = useCallback(\n\t\t(selection: ISelectionResult) => {\n\t\t\tonSlotSelect?.(selection);\n\t\t},\n\t\t[onSlotSelect]\n\t);\n\n\t// ========================================================================\n\t// RETURN\n\t// ========================================================================\n\n\treturn {\n\t\t// State\n\t\tview,\n\t\tcurrentDate,\n\t\tdateRange,\n\t\tfilters,\n\t\tpreferences,\n\n\t\t// Computed\n\t\tfilteredEvents,\n\t\tviewTitle,\n\n\t\t// Data\n\t\tevents,\n\t\tresources,\n\t\tscheduleTypes,\n\n\t\t// Actions\n\t\tsetView,\n\t\tsetCurrentDate,\n\t\tgoToNext,\n\t\tgoToPrev,\n\t\tgoToToday,\n\t\tgoToDate,\n\n\t\t// Filters\n\t\tsetFilters,\n\t\tupdateFilters,\n\t\tclearFilters,\n\n\t\t// Preferences\n\t\tsetPreferences,\n\n\t\t// Event handlers\n\t\thandleEventClick,\n\t\thandleSlotSelect,\n\t};\n}\n"],"names":["CalendarContext","createContext","CalendarProvider","children","value","jsx","useCalendarContext","context","useContext","useOptionalCalendarContext","useCalendarView","view","setView","useCalendarDate","currentDate","setCurrentDate","goToNext","goToPrev","goToToday","goToDate","useCalendarEvents","events","filteredEvents","useCalendarFilters","filters","setFilters","updateFilters","clearFilters","useCalendarPreferences","preferences","setPreferences","PREFERENCES_STORAGE_KEY","DEFAULT_VISIBLE_HOURS","DEFAULT_WORKING_HOURS","DEFAULT_SLOT_DURATION","SYSTEM_DEFAULTS","loadFromStorage","key","stored","parsed","sanitized","saveToStorage","config","modes","locked","defaults","storageKey","disableStorage","effectiveDefaults","useMemo","storedPreferences","setStoredPreferences","useState","sessionPreferences","setSessionPreferences","useEffect","getMode","useCallback","isLocked","isPersisted","result","mode","setPreference","prev","updates","sessionUpdates","storedUpdates","resetPreferences","resetPreference","_","rest","InnoCalendarContext","InnoCalendarProvider","initialEvents","initialUsers","initialScheduleTypes","initialView","initialDate","initialSelectedUserId","initialScheduleTypeIds","initialParticipantIds","initialWorkingHoursView","initialSearchQuery","preferencesConfig","onDateChange","onViewChange","setViewInternal","selectedDate","setSelectedDateInternal","selectedUserId","setSelectedUserId","badgeVariant","setBadgeVariant","variant","workingHours","setWorkingHours","action","current","newValue","prefVisibleHours","visibleHours","setVisibleHours","showWorkingHoursOnlyState","setShowWorkingHoursOnlyState","showWorkingHoursOnly","setShowWorkingHoursOnly","show","slotDuration","setSlotDuration","duration","setEvents","selectedScheduleTypeIds","setSelectedScheduleTypeIds","selectedParticipantIds","_setSelectedParticipantIds","searchQuery","setSearchQuery","newView","setSelectedDate","newDate","forView","event","p","query","useInnoCalendar","useOptionalInnoCalendar","useInnoCalendarView","useInnoCalendarEvents","useInnoCalendarFilters","useInnoCalendarTimeConfig","useCalendar","options","resources","scheduleTypes","initialFilters","userPreferences","lockedPreferences","locale","onEventClick","onSlotSelect","onFiltersChange","setViewState","setCurrentDateState","setFiltersState","setPreferencesState","DEFAULT_PREFERENCES","dateRange","getViewDateRange","viewTitle","getViewTitle","filterEventsByDateRange","scheduleTypeIds","filterEventsByScheduleType","resourceIds","filterEventsByResource","search","filterEventsBySearch","filterOutCanceled","sortEventsByStart","date","navigateNext","navigatePrev","navigateToday","newFilters","next","emptyFilters","prefs","handleEventClick","handleSlot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AAG9B;AAAA;AAAA,MAAA,EACF;AAAA,IACH;AAAA,IACA,CAACA,CAAiB;AAAA,EAAA,GAOb+B,IAAmB9G;AAAA,IACxB,CAACgE,MAAqC;AACrC,MAAAiB,IAAejB,CAAK;AAAA,IACrB;AAAA,IACA,CAACiB,CAAY;AAAA,EAAA,GAGR8B,IAAmB/G;AAAA,IACxB,CAACgH,MAAgC;AAChC,MAAA9B,IAAe8B,CAAS;AAAA,IACzB;AAAA,IACA,CAAC9B,CAAY;AAAA,EAAA;AAOd,SAAO;AAAA;AAAA,IAEN,MAAAhI;AAAA,IACA,aAAAG;AAAA,IACA,WAAAoI;AAAA,IACA,SAAA1H;AAAA,IACA,aAAAK;AAAA;AAAA,IAGA,gBAAAP;AAAA,IACA,WAAA8H;AAAA;AAAA,IAGA,QAAA/H;AAAA,IACA,WAAA+G;AAAA,IACA,eAAAC;AAAA;AAAA,IAGA,SAAAzH;AAAA,IACA,gBAAAG;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA;AAAA,IAGA,YAAAM;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA;AAAA,IAGA,gBAAAG;AAAA;AAAA,IAGA,kBAAAyI;AAAA,IACA,kBAAAC;AAAA,EAAA;AAEF;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const se=require("react/jsx-runtime"),e=require("react"),m=require("./utils.cjs"),J=e.createContext(void 0);function de({children:n,value:r}){return se.jsx(J.Provider,{value:r,children:n})}function _(){const n=e.useContext(J);if(!n)throw new Error("useCalendarContext must be used within a CalendarProvider");return n}function fe(){return e.useContext(J)}function Ce(){const{view:n,setView:r}=_();return{view:n,setView:r}}function be(){const{currentDate:n,setCurrentDate:r,goToNext:s,goToPrev:l,goToToday:k,goToDate:g}=_();return{currentDate:n,setCurrentDate:r,goToNext:s,goToPrev:l,goToToday:k,goToDate:g}}function ke(){const{events:n,filteredEvents:r}=_();return{events:n,filteredEvents:r}}function ge(){const{filters:n,setFilters:r,updateFilters:s,clearFilters:l}=_();return{filters:n,setFilters:r,updateFilters:s,clearFilters:l}}function Se(){const{preferences:n,setPreferences:r}=_();return{preferences:n,setPreferences:r}}const ne="inno-calendar-preferences",re={from:0,to:24},oe={0:{enabled:!1,from:8,to:18},1:{enabled:!0,from:8,to:18},2:{enabled:!0,from:8,to:18},3:{enabled:!0,from:8,to:18},4:{enabled:!0,from:8,to:18},5:{enabled:!0,from:8,to:18},6:{enabled:!1,from:8,to:18}},ae=30,we={view:"month",badgeVariant:"colored",slotDuration:ae,visibleHours:re,workingHours:oe,showWorkingHoursOnly:!1,showWeekends:!0,firstDayOfWeek:1};function ve(n){if(typeof window>"u")return{};try{const r=localStorage.getItem(n);if(!r)return{};const s=JSON.parse(r),l={};return s.view&&typeof s.view=="string"&&(l.view=s.view),s.badgeVariant&&typeof s.badgeVariant=="string"&&(l.badgeVariant=s.badgeVariant),s.slotDuration&&typeof s.slotDuration=="number"&&(l.slotDuration=s.slotDuration),s.visibleHours&&typeof s.visibleHours=="object"&&(l.visibleHours=s.visibleHours),s.workingHours&&typeof s.workingHours=="object"&&(l.workingHours=s.workingHours),typeof s.showWorkingHoursOnly=="boolean"&&(l.showWorkingHoursOnly=s.showWorkingHoursOnly),typeof s.showWeekends=="boolean"&&(l.showWeekends=s.showWeekends),typeof s.firstDayOfWeek=="number"&&(l.firstDayOfWeek=s.firstDayOfWeek),l}catch{return console.warn("[InnoCalendar] Failed to load preferences from localStorage"),{}}}function ye(n,r){if(!(typeof window>"u"))try{localStorage.setItem(n,JSON.stringify(r))}catch{console.warn("[InnoCalendar] Failed to save preferences to localStorage")}}function le(n={}){const{modes:r={},locked:s={},defaults:l={},storageKey:k=ne,disableStorage:g=!1}=n,V=e.useMemo(()=>({...we,...l}),[l]),[D,I]=e.useState(()=>g?{}:ve(k)),[E,H]=e.useState({});e.useEffect(()=>{g||ye(k,D)},[D,k,g]);const C=e.useCallback(o=>r[o]??"user",[r]),P=e.useCallback(o=>C(o)==="locked",[C]),F=e.useCallback(o=>C(o)==="user"&&!g,[C,g]),S=e.useMemo(()=>{const o={...V};for(const c of Object.keys(o)){const i=C(c);i==="locked"&&c in s?o[c]=s[c]:i==="session"&&c in E?o[c]=E[c]:i==="user"&&c in D&&(o[c]=D[c])}return o},[V,D,E,s,C]),u=e.useCallback((o,c)=>{const i=C(o);if(i==="locked"){console.warn(`[InnoCalendar] Preference "${o}" is locked and cannot be modified`);return}i==="session"?H(d=>({...d,[o]:c})):I(d=>({...d,[o]:c}))},[C]),b=e.useCallback(o=>{const c={},i={};for(const d of Object.keys(o)){const y=C(d),T=o[d];if(T!==void 0){if(y==="locked"){console.warn(`[InnoCalendar] Preference "${d}" is locked and cannot be modified`);continue}y==="session"?c[d]=T:i[d]=T}}Object.keys(c).length>0&&H(d=>({...d,...c})),Object.keys(i).length>0&&I(d=>({...d,...i}))},[C]),w=e.useCallback(()=>{I({}),H({}),g||localStorage.removeItem(k)},[k,g]),x=e.useCallback(o=>{const c=C(o);if(c==="locked"){console.warn(`[InnoCalendar] Preference "${o}" is locked and cannot be reset`);return}c==="session"?H(i=>{const{[o]:d,...y}=i;return y}):I(i=>{const{[o]:d,...y}=i;return y})},[C]);return{preferences:S,setPreference:u,setPreferences:b,resetPreferences:w,resetPreference:x,isLocked:P,isPersisted:F,getMode:C}}const z=e.createContext(void 0),te={0:{enabled:!1,from:8,to:17},1:{enabled:!0,from:8,to:17},2:{enabled:!0,from:8,to:17},3:{enabled:!0,from:8,to:17},4:{enabled:!0,from:8,to:17},5:{enabled:!0,from:8,to:17},6:{enabled:!0,from:8,to:12}},me={start:0,end:24};function Ie({children:n,initialEvents:r=[],initialUsers:s=[],initialScheduleTypes:l=[],initialView:k,initialDate:g,initialSelectedUserId:V="all",initialScheduleTypeIds:D=[],initialParticipantIds:I=[],initialWorkingHoursView:E="default",initialSearchQuery:H="",preferencesConfig:C,onDateChange:P,onViewChange:F}){const{preferences:S,setPreference:u,isLocked:b}=le(C),[w,x]=e.useState(k??S.view??"week"),[o,c]=e.useState(g??new Date),[i,d]=e.useState(V),y=S.badgeVariant??"colored",T=e.useCallback(a=>{b("badgeVariant")||u("badgeVariant",a)},[u,b]),A=S.workingHours??te,N=e.useCallback(a=>{if(!b("workingHours")){const f=S.workingHours??te,p=typeof a=="function"?a(f):a;u("workingHours",p)}},[u,b,S.workingHours]),v=S.visibleHours,W=e.useMemo(()=>v?{start:v.start??v.from??0,end:v.end??v.to??24}:me,[v]),M=e.useCallback(a=>{if(!b("visibleHours")){const f=typeof a=="function"?a(W):a;u("visibleHours",{from:f.start,to:f.end})}},[u,b,W]),[q,Q]=e.useState(E==="enabled"?!0:E==="disabled"?!1:S.showWorkingHoursOnly??!1),j=q,B=e.useCallback(a=>{Q(a),b("showWorkingHoursOnly")||u("showWorkingHoursOnly",a)},[u,b]),$=S.slotDuration??30,K=e.useCallback(a=>{b("slotDuration")||u("slotDuration",a)},[u,b]),[R,G]=e.useState(r);e.useEffect(()=>{G(r)},[r]);const[t,O]=e.useState(D),[h,Y]=e.useState(I),[U,ce]=e.useState(H),X=e.useCallback(a=>{x(a),b("view")||u("view",a),F?.(a)},[F,u,b]),Z=e.useCallback((a,f)=>{c(a),P?.(a,f??w)},[P,w]),ee=e.useMemo(()=>{let a=R;if(t.length>0&&(a=a.filter(f=>f.scheduleTypeId!==void 0&&t.includes(f.scheduleTypeId))),h.length>0&&(a=a.filter(f=>f.participants?.length?f.participants.some(p=>h.includes(p.id)):!1)),i!=="all"&&(a=a.filter(f=>f.participants?.some(p=>p.id===i))),U.trim()){const f=U.toLowerCase();a=a.filter(p=>p.title.toLowerCase().includes(f)||p.description?.toLowerCase().includes(f)||p.scheduleTypeName?.toLowerCase().includes(f)||p.participants?.some(ue=>ue.name.toLowerCase().includes(f)))}return a},[R,t,h,i,U]),ie=e.useMemo(()=>({view:w,setView:X,selectedDate:o,setSelectedDate:Z,selectedUserId:i,setSelectedUserId:d,badgeVariant:y,setBadgeVariant:T,workingHours:A,setWorkingHours:N,visibleHours:W,setVisibleHours:M,showWorkingHoursOnly:j,setShowWorkingHoursOnly:B,slotDuration:$,setSlotDuration:K,isPreferenceLocked:b,events:R,setEvents:G,users:s,scheduleTypes:l,selectedScheduleTypeIds:t,setSelectedScheduleTypeIds:O,searchQuery:U,setSearchQuery:ce,filteredEvents:ee}),[w,X,o,Z,i,y,T,A,N,W,M,j,B,$,K,b,R,s,l,t,U,ee]);return se.jsx(z.Provider,{value:ie,children:n})}function L(){const n=e.useContext(z);if(!n)throw new Error("useInnoCalendar must be used within an InnoCalendarProvider");return n}function he(){return e.useContext(z)}function pe(){const{view:n,setView:r,selectedDate:s,setSelectedDate:l,slotDuration:k}=L();return{view:n,setView:r,selectedDate:s,setSelectedDate:l,slotDuration:k}}function De(){const{events:n,setEvents:r,filteredEvents:s}=L();return{events:n,setEvents:r,filteredEvents:s}}function Ee(){const{selectedScheduleTypeIds:n,setSelectedScheduleTypeIds:r,selectedUserId:s,setSelectedUserId:l,searchQuery:k,setSearchQuery:g}=L();return{selectedScheduleTypeIds:n,setSelectedScheduleTypeIds:r,selectedUserId:s,setSelectedUserId:l,searchQuery:k,setSearchQuery:g}}function He(){const{workingHours:n,setWorkingHours:r,visibleHours:s,setVisibleHours:l,showWorkingHoursOnly:k,setShowWorkingHoursOnly:g}=L();return{workingHours:n,setWorkingHours:r,visibleHours:s,setVisibleHours:l,showWorkingHoursOnly:k,setShowWorkingHoursOnly:g}}function Oe(n){const{events:r,resources:s=[],scheduleTypes:l=[],initialView:k="week",initialDate:g,initialFilters:V={},preferences:D={},lockedPreferences:I={},locale:E="en-US",onViewChange:H,onDateChange:C,onEventClick:P,onSlotSelect:F,onFiltersChange:S}=n,[u,b]=e.useState(k),[w,x]=e.useState(()=>g??new Date),[o,c]=e.useState(V),[i,d]=e.useState(()=>({...m.DEFAULT_PREFERENCES,...D,...I})),y=e.useMemo(()=>m.getViewDateRange(w,u,i.firstDayOfWeek),[w,u,i.firstDayOfWeek]),T=e.useMemo(()=>m.getViewTitle(w,u,E),[w,u,E]),A=e.useMemo(()=>{let t=[...r];t=m.filterEventsByDateRange(t,y.startDate,y.endDate);const O=o.scheduleTypeIds;O&&O.length>0&&(t=m.filterEventsByScheduleType(t,O));const h=o.resourceIds;h&&h.length>0&&(t=m.filterEventsByResource(t,h));const Y=o.search;return Y&&(t=m.filterEventsBySearch(t,Y)),i.showCanceledEvents||(t=m.filterOutCanceled(t)),m.sortEventsByStart(t)},[r,y,o,i.showCanceledEvents]),N=e.useCallback(t=>{b(t),H?.(t)},[H]),v=e.useCallback(t=>{x(t),C?.(t)},[C]),W=e.useCallback(()=>{const t=m.navigateNext(w,u);v(t)},[w,u,v]),M=e.useCallback(()=>{const t=m.navigatePrev(w,u);v(t)},[w,u,v]),q=e.useCallback(()=>{v(m.navigateToday())},[v]),Q=e.useCallback(t=>{v(t)},[v]),j=e.useCallback(t=>{c(t),S?.(t)},[S]),B=e.useCallback(t=>{c(O=>{const h={...O,...t};return S?.(h),h})},[S]),$=e.useCallback(()=>{const t={};c(t),S?.(t)},[S]),K=e.useCallback(t=>{d(O=>({...O,...t,...I}))},[I]),R=e.useCallback(t=>{P?.(t)},[P]),G=e.useCallback(t=>{F?.(t)},[F]);return{view:u,currentDate:w,dateRange:y,filters:o,preferences:i,filteredEvents:A,viewTitle:T,events:r,resources:s,scheduleTypes:l,setView:N,setCurrentDate:v,goToNext:W,goToPrev:M,goToToday:q,goToDate:Q,setFilters:j,updateFilters:B,clearFilters:$,setPreferences:K,handleEventClick:R,handleSlotSelect:G}}exports.CalendarProvider=de;exports.DEFAULT_SLOT_DURATION=ae;exports.DEFAULT_VISIBLE_HOURS=re;exports.DEFAULT_WORKING_HOURS=oe;exports.InnoCalendarProvider=Ie;exports.PREFERENCES_STORAGE_KEY=ne;exports.useCalendar=Oe;exports.useCalendarContext=_;exports.useCalendarDate=be;exports.useCalendarEvents=ke;exports.useCalendarFilters=ge;exports.useCalendarPreferences=le;exports.useCalendarPreferences$1=Se;exports.useCalendarView=Ce;exports.useInnoCalendar=L;exports.useInnoCalendarEvents=De;exports.useInnoCalendarFilters=Ee;exports.useInnoCalendarTimeConfig=He;exports.useInnoCalendarView=pe;exports.useOptionalCalendarContext=fe;exports.useOptionalInnoCalendar=he;
|
|
2
|
-
//# sourceMappingURL=use-calendar-DR89bZu5.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-calendar-DR89bZu5.cjs","sources":["../src/core/context/calendar-context.tsx","../src/core/preferences/types.ts","../src/core/preferences/use-preferences.ts","../src/core/context/inno-calendar-provider.tsx","../src/core/hooks/use-calendar.ts"],"sourcesContent":["/**\n * CalendarContext - React Context for Calendar State\n *\n * Provides calendar state to deeply nested components without prop drilling.\n */\n\nimport { createContext, type ReactNode, useContext } from 'react';\nimport type { UseCalendarReturn } from '../hooks/use-calendar';\n\n// ============================================================================\n// CONTEXT\n// ============================================================================\n\n/**\n * Calendar context type - generic to support any event data type\n * We use `any` here because context consumers may not know the exact type\n * Use the typed hooks below for type-safe access\n */\n// biome-ignore lint/suspicious/noExplicitAny: Context needs to be flexible for different event types\nconst CalendarContext = createContext<UseCalendarReturn<any, any, any> | undefined>(undefined);\n\n// ============================================================================\n// PROVIDER\n// ============================================================================\n\nexport interface CalendarProviderProps<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\tchildren: ReactNode;\n\tvalue: UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData>;\n}\n\nexport function CalendarProvider<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>({ children, value }: CalendarProviderProps<TEventData, TScheduleTypeData, TResourceData>) {\n\treturn <CalendarContext.Provider value={value}>{children}</CalendarContext.Provider>;\n}\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Get the full calendar context (throws if not in provider)\n */\nexport function useCalendarContext<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> {\n\tconst context = useContext(CalendarContext);\n\tif (!context) {\n\t\tthrow new Error('useCalendarContext must be used within a CalendarProvider');\n\t}\n\treturn context as UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData>;\n}\n\n/**\n * Get the calendar context or undefined (safe version)\n */\nexport function useOptionalCalendarContext<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> | undefined {\n\tconst context = useContext(CalendarContext);\n\treturn context as UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> | undefined;\n}\n\n// ============================================================================\n// CONVENIENCE HOOKS\n// ============================================================================\n\n/**\n * Get current view\n */\nexport function useCalendarView() {\n\tconst { view, setView } = useCalendarContext();\n\treturn { view, setView };\n}\n\n/**\n * Get current date and navigation\n */\nexport function useCalendarDate() {\n\tconst { currentDate, setCurrentDate, goToNext, goToPrev, goToToday, goToDate } =\n\t\tuseCalendarContext();\n\treturn { currentDate, setCurrentDate, goToNext, goToPrev, goToToday, goToDate };\n}\n\n/**\n * Get filtered events\n */\nexport function useCalendarEvents<TEventData = Record<string, unknown>>() {\n\tconst { events, filteredEvents } = useCalendarContext<TEventData>();\n\treturn { events, filteredEvents };\n}\n\n/**\n * Get filters\n */\nexport function useCalendarFilters() {\n\tconst { filters, setFilters, updateFilters, clearFilters } = useCalendarContext();\n\treturn { filters, setFilters, updateFilters, clearFilters };\n}\n\n/**\n * Get preferences\n */\nexport function useCalendarPreferences() {\n\tconst { preferences, setPreferences } = useCalendarContext();\n\treturn { preferences, setPreferences };\n}\n\n// ============================================================================\n// ALIASES (for agenda-v2 naming convention compatibility)\n// ============================================================================\n\n/**\n * Alias for useCalendarContext - matches agenda-v2 naming convention\n */\nexport { useCalendarContext as useCalendar };\n\n/**\n * Alias for useOptionalCalendarContext - matches agenda-v2 naming convention\n */\nexport { useOptionalCalendarContext as useOptionalCalendar };\n","/**\n * Calendar Preferences Types\n *\n * Type definitions for the calendar preferences system.\n * This module enables:\n * - Persistent user preferences via localStorage\n * - Developer-controlled defaults and overrides\n * - Locking preferences to prevent user modifications\n * - Complete customization for different deployment scenarios\n */\n\nimport type { TBadgeVariant, TCalendarView, TSlotDuration } from '../types';\n\n// ============================================================================\n// PREFERENCE KEYS\n// ============================================================================\n\n/**\n * All available preference keys\n */\nexport type TPreferenceKey =\n\t| 'view'\n\t| 'badgeVariant'\n\t| 'slotDuration'\n\t| 'visibleHours'\n\t| 'workingHours'\n\t| 'showWorkingHoursOnly'\n\t| 'showWeekends'\n\t| 'firstDayOfWeek';\n\n/**\n * Storage key for localStorage\n */\nexport const PREFERENCES_STORAGE_KEY = 'inno-calendar-preferences';\n\n// ============================================================================\n// PREFERENCE VALUE TYPES\n// ============================================================================\n\n/**\n * Visible hours configuration\n */\nexport interface IVisibleHoursConfig {\n\tfrom: number;\n\tto: number;\n}\n\n/**\n * Working hours configuration per day of week\n * Key: 0 = Sunday, 1 = Monday, ..., 6 = Saturday\n */\nexport type TWorkingHoursConfig = {\n\t[dayIndex: number]: { from: number; to: number };\n};\n\n// ============================================================================\n// PREFERENCE VALUES\n// ============================================================================\n\n/**\n * Complete preferences object structure\n */\nexport interface IPreferences {\n\t/** Default calendar view */\n\tview: TCalendarView;\n\t/** Event badge display style */\n\tbadgeVariant: TBadgeVariant;\n\t/** Time slot duration in minutes (15, 30, 60) */\n\tslotDuration: TSlotDuration;\n\t/** Visible hours range for day/week views */\n\tvisibleHours: IVisibleHoursConfig;\n\t/** Working hours configuration per day */\n\tworkingHours: TWorkingHoursConfig;\n\t/** Show only working hours in day/week views */\n\tshowWorkingHoursOnly: boolean;\n\t/** Show weekend days */\n\tshowWeekends: boolean;\n\t/** First day of week (0 = Sunday, 1 = Monday, etc.) */\n\tfirstDayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n}\n\n/**\n * Partial preferences for updates\n */\nexport type TPartialPreferences = Partial<IPreferences>;\n\n// ============================================================================\n// PREFERENCE CONTROL\n// ============================================================================\n\n/**\n * Control mode for each preference\n * - 'user': User can modify, persisted to localStorage\n * - 'locked': Developer-controlled, cannot be modified by user\n * - 'session': User can modify during session, not persisted\n */\nexport type TPreferenceMode = 'user' | 'locked' | 'session';\n\n/**\n * Configuration for preference control\n * Allows developers to lock certain preferences to specific values\n */\nexport type TPreferenceModes = {\n\t[K in TPreferenceKey]?: TPreferenceMode;\n};\n\n/**\n * Locked values for preferences\n * When a preference mode is 'locked', this value is used\n */\nexport type TLockedPreferences = TPartialPreferences;\n\n// ============================================================================\n// PREFERENCES CONFIG\n// ============================================================================\n\n/**\n * Complete preferences configuration for developers\n *\n * @example\n * // Allow all preferences to be user-controlled (default)\n * const config: IPreferencesConfig = {};\n *\n * @example\n * // Lock slot duration to 30 minutes, let users control the rest\n * const config: IPreferencesConfig = {\n * modes: { slotDuration: 'locked' },\n * locked: { slotDuration: 30 }\n * };\n *\n * @example\n * // Completely override all preferences (no user control)\n * const config: IPreferencesConfig = {\n * modes: {\n * view: 'locked',\n * badgeVariant: 'locked',\n * slotDuration: 'locked',\n * visibleHours: 'locked',\n * workingHours: 'locked',\n * showWorkingHoursOnly: 'locked'\n * },\n * locked: {\n * view: 'week',\n * badgeVariant: 'colored',\n * slotDuration: 30,\n * visibleHours: { from: 8, to: 18 },\n * workingHours: { ... },\n * showWorkingHoursOnly: true\n * }\n * };\n */\nexport interface IPreferencesConfig {\n\t/**\n\t * Control mode for each preference\n\t * Defaults to 'user' for all preferences\n\t */\n\tmodes?: TPreferenceModes;\n\n\t/**\n\t * Values to use when preference mode is 'locked'\n\t */\n\tlocked?: TLockedPreferences;\n\n\t/**\n\t * Custom default values (used when no stored preference exists)\n\t * These override the system defaults\n\t */\n\tdefaults?: TPartialPreferences;\n\n\t/**\n\t * Custom localStorage key (default: 'inno-calendar-preferences')\n\t * Useful when multiple calendar instances need separate storage\n\t */\n\tstorageKey?: string;\n\n\t/**\n\t * Disable localStorage entirely\n\t * All preferences will reset on page reload\n\t */\n\tdisableStorage?: boolean;\n}\n\n// ============================================================================\n// HOOK RETURN TYPE\n// ============================================================================\n\n/**\n * Return type for useCalendarPreferences hook\n */\nexport interface IUsePreferencesReturn {\n\t/** Current preference values */\n\tpreferences: IPreferences;\n\n\t/** Update a single preference */\n\tsetPreference: <K extends TPreferenceKey>(key: K, value: IPreferences[K]) => void;\n\n\t/** Update multiple preferences at once */\n\tsetPreferences: (updates: TPartialPreferences) => void;\n\n\t/** Reset preferences to defaults */\n\tresetPreferences: () => void;\n\n\t/** Reset a single preference to default */\n\tresetPreference: (key: TPreferenceKey) => void;\n\n\t/** Check if a preference is locked */\n\tisLocked: (key: TPreferenceKey) => boolean;\n\n\t/** Check if a preference is persisted */\n\tisPersisted: (key: TPreferenceKey) => boolean;\n\n\t/** Get the mode for a preference */\n\tgetMode: (key: TPreferenceKey) => TPreferenceMode;\n}\n","/**\n * Calendar Preferences Hook\n *\n * Manages calendar preferences with localStorage persistence and developer control.\n *\n * Features:\n * - Automatic localStorage persistence\n * - Developer-controlled defaults and overrides\n * - Preference locking for controlled deployments\n * - Session-only preferences that don't persist\n * - Type-safe preference access and updates\n *\n * @example Basic usage\n * ```tsx\n * const { preferences, setPreference } = useCalendarPreferences();\n * setPreference('slotDuration', 30);\n * ```\n *\n * @example With developer configuration\n * ```tsx\n * const { preferences } = useCalendarPreferences({\n * modes: { slotDuration: 'locked' },\n * locked: { slotDuration: 60 },\n * defaults: { view: 'week' }\n * });\n * ```\n */\n\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport type { TWorkingHours } from '../types';\nimport {\n\ttype IPreferences,\n\ttype IPreferencesConfig,\n\ttype IUsePreferencesReturn,\n\tPREFERENCES_STORAGE_KEY,\n\ttype TPartialPreferences,\n\ttype TPreferenceKey,\n\ttype TPreferenceMode,\n} from './types';\n\n// ============================================================================\n// SYSTEM DEFAULTS\n// ============================================================================\n\n/**\n * Default visible hours\n */\nexport const DEFAULT_VISIBLE_HOURS = {\n\tfrom: 0,\n\tto: 24,\n};\n\n/**\n * Default working hours (Monday-Friday, 8am-6pm)\n */\nexport const DEFAULT_WORKING_HOURS: TWorkingHours = {\n\t0: { enabled: false, from: 8, to: 18 }, // Sunday - disabled\n\t1: { enabled: true, from: 8, to: 18 }, // Monday\n\t2: { enabled: true, from: 8, to: 18 }, // Tuesday\n\t3: { enabled: true, from: 8, to: 18 }, // Wednesday\n\t4: { enabled: true, from: 8, to: 18 }, // Thursday\n\t5: { enabled: true, from: 8, to: 18 }, // Friday\n\t6: { enabled: false, from: 8, to: 18 }, // Saturday - disabled\n};\n\n/**\n * Default slot duration in minutes\n */\nexport const DEFAULT_SLOT_DURATION = 30;\n\n/**\n * System default preferences\n * These are used when no stored preference or custom default exists\n */\nconst SYSTEM_DEFAULTS: IPreferences = {\n\tview: 'month',\n\tbadgeVariant: 'colored',\n\tslotDuration: DEFAULT_SLOT_DURATION,\n\tvisibleHours: DEFAULT_VISIBLE_HOURS,\n\tworkingHours: DEFAULT_WORKING_HOURS,\n\tshowWorkingHoursOnly: false,\n\tshowWeekends: true,\n\tfirstDayOfWeek: 1,\n};\n\n// ============================================================================\n// STORAGE HELPERS\n// ============================================================================\n\n/**\n * Load preferences from localStorage\n */\nfunction loadFromStorage(key: string): TPartialPreferences {\n\tif (typeof window === 'undefined') return {};\n\n\ttry {\n\t\tconst stored = localStorage.getItem(key);\n\t\tif (!stored) return {};\n\n\t\tconst parsed = JSON.parse(stored);\n\n\t\t// Validate and sanitize stored values\n\t\tconst sanitized: TPartialPreferences = {};\n\n\t\tif (parsed.view && typeof parsed.view === 'string') {\n\t\t\tsanitized.view = parsed.view;\n\t\t}\n\n\t\tif (parsed.badgeVariant && typeof parsed.badgeVariant === 'string') {\n\t\t\tsanitized.badgeVariant = parsed.badgeVariant;\n\t\t}\n\n\t\tif (parsed.slotDuration && typeof parsed.slotDuration === 'number') {\n\t\t\tsanitized.slotDuration = parsed.slotDuration;\n\t\t}\n\n\t\tif (parsed.visibleHours && typeof parsed.visibleHours === 'object') {\n\t\t\tsanitized.visibleHours = parsed.visibleHours;\n\t\t}\n\n\t\tif (parsed.workingHours && typeof parsed.workingHours === 'object') {\n\t\t\tsanitized.workingHours = parsed.workingHours;\n\t\t}\n\n\t\tif (typeof parsed.showWorkingHoursOnly === 'boolean') {\n\t\t\tsanitized.showWorkingHoursOnly = parsed.showWorkingHoursOnly;\n\t\t}\n\n\t\tif (typeof parsed.showWeekends === 'boolean') {\n\t\t\tsanitized.showWeekends = parsed.showWeekends;\n\t\t}\n\n\t\tif (typeof parsed.firstDayOfWeek === 'number') {\n\t\t\tsanitized.firstDayOfWeek = parsed.firstDayOfWeek;\n\t\t}\n\n\t\treturn sanitized;\n\t} catch {\n\t\tconsole.warn('[InnoCalendar] Failed to load preferences from localStorage');\n\t\treturn {};\n\t}\n}\n\n/**\n * Save preferences to localStorage\n */\nfunction saveToStorage(key: string, preferences: TPartialPreferences): void {\n\tif (typeof window === 'undefined') return;\n\n\ttry {\n\t\tlocalStorage.setItem(key, JSON.stringify(preferences));\n\t} catch {\n\t\tconsole.warn('[InnoCalendar] Failed to save preferences to localStorage');\n\t}\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\n/**\n * Calendar preferences hook with localStorage persistence\n *\n * @param config - Optional configuration for preferences behavior\n * @returns Preferences state and control functions\n */\nexport function useCalendarPreferences(config: IPreferencesConfig = {}): IUsePreferencesReturn {\n\tconst {\n\t\tmodes = {},\n\t\tlocked = {},\n\t\tdefaults = {},\n\t\tstorageKey = PREFERENCES_STORAGE_KEY,\n\t\tdisableStorage = false,\n\t} = config;\n\n\t// Compute effective defaults (system + custom)\n\tconst effectiveDefaults = useMemo<IPreferences>(\n\t\t() => ({\n\t\t\t...SYSTEM_DEFAULTS,\n\t\t\t...defaults,\n\t\t}),\n\t\t[defaults]\n\t);\n\n\t// Initialize state with stored + defaults\n\tconst [storedPreferences, setStoredPreferences] = useState<TPartialPreferences>(() => {\n\t\tif (disableStorage) return {};\n\t\treturn loadFromStorage(storageKey);\n\t});\n\n\t// Session-only preferences (not persisted)\n\tconst [sessionPreferences, setSessionPreferences] = useState<TPartialPreferences>({});\n\n\t// Save to localStorage when stored preferences change\n\tuseEffect(() => {\n\t\tif (disableStorage) return;\n\t\tsaveToStorage(storageKey, storedPreferences);\n\t}, [storedPreferences, storageKey, disableStorage]);\n\n\t// Get mode for a preference\n\tconst getMode = useCallback(\n\t\t(key: TPreferenceKey): TPreferenceMode => {\n\t\t\treturn modes[key] ?? 'user';\n\t\t},\n\t\t[modes]\n\t);\n\n\t// Check if preference is locked\n\tconst isLocked = useCallback(\n\t\t(key: TPreferenceKey): boolean => {\n\t\t\treturn getMode(key) === 'locked';\n\t\t},\n\t\t[getMode]\n\t);\n\n\t// Check if preference is persisted\n\tconst isPersisted = useCallback(\n\t\t(key: TPreferenceKey): boolean => {\n\t\t\tconst mode = getMode(key);\n\t\t\treturn mode === 'user' && !disableStorage;\n\t\t},\n\t\t[getMode, disableStorage]\n\t);\n\n\t// Compute final preferences (locked > session > stored > defaults)\n\tconst preferences = useMemo<IPreferences>(() => {\n\t\tconst result = { ...effectiveDefaults };\n\n\t\t// Apply stored preferences (for 'user' mode)\n\t\tfor (const key of Object.keys(result) as TPreferenceKey[]) {\n\t\t\tconst mode = getMode(key);\n\n\t\t\tif (mode === 'locked' && key in locked) {\n\t\t\t\t// Use locked value\n\t\t\t\t(result as Record<string, unknown>)[key] = locked[key];\n\t\t\t} else if (mode === 'session' && key in sessionPreferences) {\n\t\t\t\t// Use session value\n\t\t\t\t(result as Record<string, unknown>)[key] = sessionPreferences[key];\n\t\t\t} else if (mode === 'user' && key in storedPreferences) {\n\t\t\t\t// Use stored value\n\t\t\t\t(result as Record<string, unknown>)[key] = storedPreferences[key];\n\t\t\t}\n\t\t\t// Otherwise, keep default\n\t\t}\n\n\t\treturn result;\n\t}, [effectiveDefaults, storedPreferences, sessionPreferences, locked, getMode]);\n\n\t// Set a single preference\n\tconst setPreference = useCallback(\n\t\t<K extends TPreferenceKey>(key: K, value: IPreferences[K]) => {\n\t\t\tconst mode = getMode(key);\n\n\t\t\t// Can't modify locked preferences\n\t\t\tif (mode === 'locked') {\n\t\t\t\tconsole.warn(`[InnoCalendar] Preference \"${key}\" is locked and cannot be modified`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mode === 'session') {\n\t\t\t\tsetSessionPreferences((prev) => ({ ...prev, [key]: value }));\n\t\t\t} else {\n\t\t\t\tsetStoredPreferences((prev) => ({ ...prev, [key]: value }));\n\t\t\t}\n\t\t},\n\t\t[getMode]\n\t);\n\n\t// Set multiple preferences at once\n\tconst setPreferences = useCallback(\n\t\t(updates: TPartialPreferences) => {\n\t\t\tconst sessionUpdates: TPartialPreferences = {};\n\t\t\tconst storedUpdates: TPartialPreferences = {};\n\n\t\t\tfor (const key of Object.keys(updates) as TPreferenceKey[]) {\n\t\t\t\tconst mode = getMode(key);\n\t\t\t\tconst value = updates[key];\n\n\t\t\t\tif (value === undefined) continue;\n\n\t\t\t\tif (mode === 'locked') {\n\t\t\t\t\tconsole.warn(`[InnoCalendar] Preference \"${key}\" is locked and cannot be modified`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (mode === 'session') {\n\t\t\t\t\t(sessionUpdates as Record<string, unknown>)[key] = value;\n\t\t\t\t} else {\n\t\t\t\t\t(storedUpdates as Record<string, unknown>)[key] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (Object.keys(sessionUpdates).length > 0) {\n\t\t\t\tsetSessionPreferences((prev) => ({ ...prev, ...sessionUpdates }));\n\t\t\t}\n\n\t\t\tif (Object.keys(storedUpdates).length > 0) {\n\t\t\t\tsetStoredPreferences((prev) => ({ ...prev, ...storedUpdates }));\n\t\t\t}\n\t\t},\n\t\t[getMode]\n\t);\n\n\t// Reset all preferences to defaults\n\tconst resetPreferences = useCallback(() => {\n\t\tsetStoredPreferences({});\n\t\tsetSessionPreferences({});\n\n\t\tif (!disableStorage) {\n\t\t\tlocalStorage.removeItem(storageKey);\n\t\t}\n\t}, [storageKey, disableStorage]);\n\n\t// Reset a single preference to default\n\tconst resetPreference = useCallback(\n\t\t(key: TPreferenceKey) => {\n\t\t\tconst mode = getMode(key);\n\n\t\t\tif (mode === 'locked') {\n\t\t\t\tconsole.warn(`[InnoCalendar] Preference \"${key}\" is locked and cannot be reset`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mode === 'session') {\n\t\t\t\tsetSessionPreferences((prev) => {\n\t\t\t\t\tconst { [key]: _, ...rest } = prev;\n\t\t\t\t\treturn rest;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tsetStoredPreferences((prev) => {\n\t\t\t\t\tconst { [key]: _, ...rest } = prev;\n\t\t\t\t\treturn rest;\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[getMode]\n\t);\n\n\treturn {\n\t\tpreferences,\n\t\tsetPreference,\n\t\tsetPreferences,\n\t\tresetPreferences,\n\t\tresetPreference,\n\t\tisLocked,\n\t\tisPersisted,\n\t\tgetMode,\n\t};\n}\n\nexport default useCalendarPreferences;\n","/**\n * InnoCalendar Provider\n *\n * A CalendarProvider that matches agenda-v2's API exactly.\n * This is an all-in-one provider that manages state internally\n * rather than requiring consumers to use useCalendar separately.\n *\n * Features:\n * - Automatic preference persistence to localStorage\n * - Developer-controlled preference locking\n * - Same prop interface as agenda-v2's CalendarProvider\n * - Same context shape for component compatibility\n */\n\nimport {\n createContext,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport {\n type IPreferencesConfig,\n type TPreferenceKey,\n useCalendarPreferences,\n} from \"../preferences\";\nimport type {\n CalendarEvent,\n ICalendarUser,\n IScheduleType,\n TBadgeVariant,\n TCalendarView,\n TSlotDuration,\n TWorkingHours,\n} from \"../types\";\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\n// Re-export types from core/types for convenience\nexport type { IWorkingHoursDay, TSlotDuration, TWorkingHours } from \"../types\";\n\n/**\n * Visible hours configuration\n * Using start/end to match agenda-v2 naming\n */\nexport interface TVisibleHours {\n start: number;\n end: number;\n}\n\n// ============================================================================\n// CONTEXT INTERFACE - Matches agenda-v2 exactly\n// ============================================================================\n\nexport interface IInnoCalendarContext<TEventData = Record<string, unknown>> {\n // View & Navigation\n view: TCalendarView;\n setView: (view: TCalendarView) => void;\n selectedDate: Date;\n /** Set selected date. Pass optional forView to use that view for date range calculation. */\n setSelectedDate: (date: Date, forView?: TCalendarView) => void;\n\n // User/Participant Filtering\n selectedUserId: string | \"all\";\n setSelectedUserId: (userId: string | \"all\") => void;\n\n // Visual Customization\n badgeVariant: TBadgeVariant;\n setBadgeVariant: (variant: TBadgeVariant) => void;\n\n // Time Configuration\n workingHours: TWorkingHours;\n setWorkingHours: Dispatch<SetStateAction<TWorkingHours>>;\n visibleHours: TVisibleHours;\n setVisibleHours: Dispatch<SetStateAction<TVisibleHours>>;\n showWorkingHoursOnly: boolean;\n setShowWorkingHoursOnly: (show: boolean) => void;\n slotDuration: TSlotDuration;\n setSlotDuration: (duration: TSlotDuration) => void;\n\n // Preferences\n /**\n * Check if a specific preference is locked by the developer.\n * Useful for conditionally disabling UI controls.\n */\n isPreferenceLocked: (key: TPreferenceKey) => boolean;\n\n // Data\n events: CalendarEvent<TEventData>[];\n setEvents: Dispatch<SetStateAction<CalendarEvent<TEventData>[]>>;\n users: ICalendarUser[];\n scheduleTypes: IScheduleType[];\n\n // Filter state (schedule types)\n selectedScheduleTypeIds: number[];\n setSelectedScheduleTypeIds: Dispatch<SetStateAction<number[]>>;\n\n // Search\n searchQuery: string;\n setSearchQuery: (query: string) => void;\n\n // Computed / Filtered Events\n filteredEvents: CalendarEvent<TEventData>[];\n}\n\n// ============================================================================\n// CONTEXT\n// ============================================================================\n\n// biome-ignore lint/suspicious/noExplicitAny: Context needs flexibility for different event types\nconst InnoCalendarContext = createContext<\n IInnoCalendarContext<any> | undefined\n>(undefined);\n\n// ============================================================================\n// DEFAULT WORKING HOURS\n// ============================================================================\n\nconst DEFAULT_WORKING_HOURS: TWorkingHours = {\n 0: { enabled: false, from: 8, to: 17 }, // Sunday\n 1: { enabled: true, from: 8, to: 17 }, // Monday\n 2: { enabled: true, from: 8, to: 17 }, // Tuesday\n 3: { enabled: true, from: 8, to: 17 }, // Wednesday\n 4: { enabled: true, from: 8, to: 17 }, // Thursday\n 5: { enabled: true, from: 8, to: 17 }, // Friday\n 6: { enabled: true, from: 8, to: 12 }, // Saturday\n};\n\nconst DEFAULT_VISIBLE_HOURS: TVisibleHours = { start: 0, end: 24 };\n\n// ============================================================================\n// PROVIDER PROPS - Matches agenda-v2 exactly\n// ============================================================================\n\nexport interface InnoCalendarProviderProps<\n TEventData = Record<string, unknown>,\n> {\n children: ReactNode;\n\n // Initial data from server/loader\n initialEvents?: CalendarEvent<TEventData>[];\n initialUsers?: ICalendarUser[];\n initialScheduleTypes?: IScheduleType[];\n\n // Initial filter state (from URL)\n initialView?: TCalendarView;\n initialDate?: Date;\n initialSelectedUserId?: string | \"all\";\n initialScheduleTypeIds?: number[];\n initialParticipantIds?: string[];\n initialWorkingHoursView?: \"default\" | \"enabled\" | \"disabled\";\n initialSearchQuery?: string;\n\n /**\n * Preferences configuration for developer control\n */\n preferencesConfig?: IPreferencesConfig;\n\n // Callbacks for parent sync\n onDateChange?: (date: Date, view: TCalendarView) => void;\n onViewChange?: (view: TCalendarView) => void;\n}\n\n// ============================================================================\n// PROVIDER COMPONENT\n// ============================================================================\n\nexport function InnoCalendarProvider<TEventData = Record<string, unknown>>({\n children,\n initialEvents = [],\n initialUsers = [],\n initialScheduleTypes = [],\n initialView,\n initialDate,\n initialSelectedUserId = \"all\",\n initialScheduleTypeIds = [],\n initialParticipantIds = [],\n initialWorkingHoursView = \"default\",\n initialSearchQuery = \"\",\n preferencesConfig,\n onDateChange,\n onViewChange,\n}: InnoCalendarProviderProps<TEventData>) {\n // ========================================================================\n // PREFERENCES (persisted to localStorage)\n // ========================================================================\n const { preferences, setPreference, isLocked } =\n useCalendarPreferences(preferencesConfig);\n\n // ========================================================================\n // VIEW & NAVIGATION\n // ========================================================================\n const [view, setViewInternal] = useState<TCalendarView>(\n initialView ?? (preferences.view as TCalendarView) ?? \"week\",\n );\n const [selectedDate, setSelectedDateInternal] = useState<Date>(\n initialDate ?? new Date(),\n );\n\n // User Filtering\n const [selectedUserId, setSelectedUserId] = useState<string | \"all\">(\n initialSelectedUserId,\n );\n\n // ========================================================================\n // PREFERENCE-BACKED STATE\n // ========================================================================\n const badgeVariant = (preferences.badgeVariant as TBadgeVariant) ?? \"colored\";\n const setBadgeVariant = useCallback(\n (variant: TBadgeVariant) => {\n if (!isLocked(\"badgeVariant\")) {\n setPreference(\"badgeVariant\", variant);\n }\n },\n [setPreference, isLocked],\n );\n\n const workingHours =\n (preferences.workingHours as TWorkingHours) ?? DEFAULT_WORKING_HOURS;\n const setWorkingHours: Dispatch<SetStateAction<TWorkingHours>> = useCallback(\n (action) => {\n if (!isLocked(\"workingHours\")) {\n const current =\n (preferences.workingHours as TWorkingHours) ?? DEFAULT_WORKING_HOURS;\n const newValue =\n typeof action === \"function\" ? action(current) : action;\n setPreference(\"workingHours\", newValue);\n }\n },\n [setPreference, isLocked, preferences.workingHours],\n );\n\n // Convert preferences format (from/to) to our format (start/end)\n const prefVisibleHours = preferences.visibleHours as\n | { from?: number; to?: number; start?: number; end?: number }\n | undefined;\n const visibleHours: TVisibleHours = useMemo(() => {\n if (!prefVisibleHours) return DEFAULT_VISIBLE_HOURS;\n // Handle both formats\n return {\n start: prefVisibleHours.start ?? prefVisibleHours.from ?? 0,\n end: prefVisibleHours.end ?? prefVisibleHours.to ?? 24,\n };\n }, [prefVisibleHours]);\n\n const setVisibleHours: Dispatch<SetStateAction<TVisibleHours>> = useCallback(\n (action) => {\n if (!isLocked(\"visibleHours\")) {\n const newValue =\n typeof action === \"function\" ? action(visibleHours) : action;\n // Store in preferences format (from/to)\n setPreference(\"visibleHours\", {\n from: newValue.start,\n to: newValue.end,\n });\n }\n },\n [setPreference, isLocked, visibleHours],\n );\n\n // showWorkingHoursOnly can be overridden by URL param\n const [showWorkingHoursOnlyState, setShowWorkingHoursOnlyState] = useState(\n initialWorkingHoursView === \"enabled\"\n ? true\n : initialWorkingHoursView === \"disabled\"\n ? false\n : ((preferences.showWorkingHoursOnly as boolean) ?? false),\n );\n const showWorkingHoursOnly = showWorkingHoursOnlyState;\n const setShowWorkingHoursOnly = useCallback(\n (show: boolean) => {\n setShowWorkingHoursOnlyState(show);\n if (!isLocked(\"showWorkingHoursOnly\")) {\n setPreference(\"showWorkingHoursOnly\", show);\n }\n },\n [setPreference, isLocked],\n );\n\n const slotDuration = (preferences.slotDuration as TSlotDuration) ?? 30;\n const setSlotDuration = useCallback(\n (duration: TSlotDuration) => {\n if (!isLocked(\"slotDuration\")) {\n setPreference(\"slotDuration\", duration);\n }\n },\n [setPreference, isLocked],\n );\n\n // ========================================================================\n // DATA\n // ========================================================================\n const [events, setEvents] =\n useState<CalendarEvent<TEventData>[]>(initialEvents);\n\n // Sync events when initialEvents changes (e.g., after navigation/refetch)\n useEffect(() => {\n setEvents(initialEvents);\n }, [initialEvents]);\n\n // Filter State\n const [selectedScheduleTypeIds, setSelectedScheduleTypeIds] = useState<\n number[]\n >(initialScheduleTypeIds);\n const [selectedParticipantIds, _setSelectedParticipantIds] = useState<\n string[]\n >(initialParticipantIds);\n\n // Search\n const [searchQuery, setSearchQuery] = useState(initialSearchQuery);\n\n // ========================================================================\n // VIEW & DATE SETTERS\n // ========================================================================\n const setView = useCallback(\n (newView: TCalendarView) => {\n setViewInternal(newView);\n if (!isLocked(\"view\")) {\n setPreference(\"view\", newView);\n }\n onViewChange?.(newView);\n },\n [onViewChange, setPreference, isLocked],\n );\n\n const setSelectedDate = useCallback(\n (newDate: Date, forView?: TCalendarView) => {\n setSelectedDateInternal(newDate);\n onDateChange?.(newDate, forView ?? view);\n },\n [onDateChange, view],\n );\n\n // ========================================================================\n // FILTERED EVENTS\n // ========================================================================\n const filteredEvents = useMemo(() => {\n let result = events;\n\n // Filter by schedule type\n if (selectedScheduleTypeIds.length > 0) {\n result = result.filter(\n (event) =>\n event.scheduleTypeId !== undefined &&\n selectedScheduleTypeIds.includes(event.scheduleTypeId),\n );\n }\n\n // Filter by participant\n if (selectedParticipantIds.length > 0) {\n result = result.filter((event) => {\n // Check participants array (includes primary user in this model)\n if (event.participants?.length) {\n return event.participants.some((p) =>\n selectedParticipantIds.includes(p.id),\n );\n }\n return false;\n });\n }\n\n // Filter by selected user (single user view)\n if (selectedUserId !== \"all\") {\n result = result.filter((event) =>\n event.participants?.some((p) => p.id === selectedUserId),\n );\n }\n\n // Filter by search query\n if (searchQuery.trim()) {\n const query = searchQuery.toLowerCase();\n result = result.filter(\n (event) =>\n event.title.toLowerCase().includes(query) ||\n event.description?.toLowerCase().includes(query) ||\n event.scheduleTypeName?.toLowerCase().includes(query) ||\n event.participants?.some((p) => p.name.toLowerCase().includes(query)),\n );\n }\n\n return result;\n }, [\n events,\n selectedScheduleTypeIds,\n selectedParticipantIds,\n selectedUserId,\n searchQuery,\n ]);\n\n // ========================================================================\n // CONTEXT VALUE\n // ========================================================================\n const value = useMemo<IInnoCalendarContext<TEventData>>(\n () => ({\n // View & Navigation\n view,\n setView,\n selectedDate,\n setSelectedDate,\n\n // User Filtering\n selectedUserId,\n setSelectedUserId,\n\n // Visual Customization\n badgeVariant,\n setBadgeVariant,\n\n // Time Configuration\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n slotDuration,\n setSlotDuration,\n\n // Preferences\n isPreferenceLocked: isLocked,\n\n // Data\n events,\n setEvents,\n users: initialUsers,\n scheduleTypes: initialScheduleTypes,\n\n // Filters\n selectedScheduleTypeIds,\n setSelectedScheduleTypeIds,\n\n // Search\n searchQuery,\n setSearchQuery,\n\n // Computed\n filteredEvents,\n }),\n [\n view,\n setView,\n selectedDate,\n setSelectedDate,\n selectedUserId,\n badgeVariant,\n setBadgeVariant,\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n slotDuration,\n setSlotDuration,\n isLocked,\n events,\n initialUsers,\n initialScheduleTypes,\n selectedScheduleTypeIds,\n searchQuery,\n filteredEvents,\n ],\n );\n\n return (\n <InnoCalendarContext.Provider value={value}>\n {children}\n </InnoCalendarContext.Provider>\n );\n}\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Get the full calendar context\n * This is the primary hook - use this in most components\n */\nexport function useInnoCalendar<\n TEventData = Record<string, unknown>,\n>(): IInnoCalendarContext<TEventData> {\n const context = useContext(InnoCalendarContext);\n if (!context) {\n throw new Error(\n \"useInnoCalendar must be used within an InnoCalendarProvider\",\n );\n }\n return context as IInnoCalendarContext<TEventData>;\n}\n\n/**\n * Optional calendar context hook\n */\nexport function useOptionalInnoCalendar<\n TEventData = Record<string, unknown>,\n>(): IInnoCalendarContext<TEventData> | undefined {\n return useContext(InnoCalendarContext) as\n | IInnoCalendarContext<TEventData>\n | undefined;\n}\n\n// ============================================================================\n// SELECTIVE HOOKS (for performance optimization)\n// ============================================================================\n\n/**\n * Access only view-related state\n */\nexport function useInnoCalendarView() {\n const { view, setView, selectedDate, setSelectedDate, slotDuration } =\n useInnoCalendar();\n return { view, setView, selectedDate, setSelectedDate, slotDuration };\n}\n\n/**\n * Access only events data\n */\nexport function useInnoCalendarEvents<TEventData = Record<string, unknown>>() {\n const { events, setEvents, filteredEvents } = useInnoCalendar<TEventData>();\n return { events, setEvents, filteredEvents };\n}\n\n/**\n * Access only filter state\n */\nexport function useInnoCalendarFilters() {\n const {\n selectedScheduleTypeIds,\n setSelectedScheduleTypeIds,\n selectedUserId,\n setSelectedUserId,\n searchQuery,\n setSearchQuery,\n } = useInnoCalendar();\n return {\n selectedScheduleTypeIds,\n setSelectedScheduleTypeIds,\n selectedUserId,\n setSelectedUserId,\n searchQuery,\n setSearchQuery,\n };\n}\n\n/**\n * Access only time configuration\n */\nexport function useInnoCalendarTimeConfig() {\n const {\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n } = useInnoCalendar();\n return {\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n };\n}\n","/**\n * useCalendar - Main Calendar Hook\n *\n * This hook provides all the state and methods needed to build a calendar.\n * It is fully generic, allowing consumers to define their own event data types.\n *\n * @example\n * ```tsx\n * interface MyEventData {\n * projectId: number;\n * priority: 'low' | 'medium' | 'high';\n * }\n *\n * const calendar = useCalendar<MyEventData>({\n * events: myEvents,\n * onEventClick: (event) => {\n * console.log(event.data?.projectId);\n * },\n * });\n * ```\n */\n\nimport { useCallback, useMemo, useState } from 'react';\nimport { DEFAULT_PREFERENCES } from '../constants';\nimport type {\n\tCalendarEvent,\n\tICalendarFilters,\n\tICalendarPreferences,\n\tIDateRange,\n\tIResource,\n\tIScheduleType,\n\tISelectionResult,\n\tTCalendarView,\n} from '../types';\nimport {\n\tfilterEventsByDateRange,\n\tfilterEventsByResource,\n\tfilterEventsByScheduleType,\n\tfilterEventsBySearch,\n\tfilterOutCanceled,\n\tsortEventsByStart,\n} from '../utils/event-utils';\nimport {\n\tgetViewDateRange,\n\tgetViewTitle,\n\tnavigateNext,\n\tnavigatePrev,\n\tnavigateToday,\n} from '../utils/grid-utils';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\n/**\n * Options for useCalendar hook\n */\nexport interface UseCalendarOptions<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\t/** Events to display */\n\tevents: CalendarEvent<TEventData>[];\n\n\t/** Available resources (for resource views) */\n\tresources?: IResource<TResourceData>[] | undefined;\n\n\t/** Available schedule types */\n\tscheduleTypes?: IScheduleType<TScheduleTypeData>[] | undefined;\n\n\t/** Initial view */\n\tinitialView?: TCalendarView | undefined;\n\n\t/** Initial date */\n\tinitialDate?: Date | undefined;\n\n\t/** Initial filters */\n\tinitialFilters?: ICalendarFilters | undefined;\n\n\t/** User preferences */\n\tpreferences?: Partial<ICalendarPreferences> | undefined;\n\n\t/** Locked preferences (cannot be changed by user) */\n\tlockedPreferences?: Partial<ICalendarPreferences> | undefined;\n\n\t/** Locale for formatting */\n\tlocale?: string | undefined;\n\n\t/** Callback when view changes */\n\tonViewChange?: ((view: TCalendarView) => void) | undefined;\n\n\t/** Callback when date changes */\n\tonDateChange?: ((date: Date) => void) | undefined;\n\n\t/** Callback when event is clicked */\n\tonEventClick?: ((event: CalendarEvent<TEventData>) => void) | undefined;\n\n\t/** Callback when slot is selected */\n\tonSlotSelect?: ((selection: ISelectionResult) => void) | undefined;\n\n\t/** Callback when filters change */\n\tonFiltersChange?: ((filters: ICalendarFilters) => void) | undefined;\n}\n\n/**\n * Return type for useCalendar hook\n */\nexport interface UseCalendarReturn<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\t// State\n\tview: TCalendarView;\n\tcurrentDate: Date;\n\tdateRange: IDateRange;\n\tfilters: ICalendarFilters;\n\tpreferences: ICalendarPreferences;\n\n\t// Computed\n\tfilteredEvents: CalendarEvent<TEventData>[];\n\tviewTitle: string;\n\n\t// Data\n\tevents: CalendarEvent<TEventData>[];\n\tresources: IResource<TResourceData>[];\n\tscheduleTypes: IScheduleType<TScheduleTypeData>[];\n\n\t// Actions\n\tsetView: (view: TCalendarView) => void;\n\tsetCurrentDate: (date: Date) => void;\n\tgoToNext: () => void;\n\tgoToPrev: () => void;\n\tgoToToday: () => void;\n\tgoToDate: (date: Date) => void;\n\n\t// Filters\n\tsetFilters: (filters: ICalendarFilters) => void;\n\tupdateFilters: (updates: Partial<ICalendarFilters>) => void;\n\tclearFilters: () => void;\n\n\t// Preferences\n\tsetPreferences: (prefs: Partial<ICalendarPreferences>) => void;\n\n\t// Event handlers\n\thandleEventClick: (event: CalendarEvent<TEventData>) => void;\n\thandleSlotSelect: (selection: ISelectionResult) => void;\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function useCalendar<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(\n\toptions: UseCalendarOptions<TEventData, TScheduleTypeData, TResourceData>\n): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> {\n\tconst {\n\t\tevents,\n\t\tresources = [],\n\t\tscheduleTypes = [],\n\t\tinitialView = 'week',\n\t\tinitialDate,\n\t\tinitialFilters = {},\n\t\tpreferences: userPreferences = {},\n\t\tlockedPreferences = {},\n\t\tlocale = 'en-US',\n\t\tonViewChange,\n\t\tonDateChange,\n\t\tonEventClick,\n\t\tonSlotSelect,\n\t\tonFiltersChange,\n\t} = options;\n\n\t// ========================================================================\n\t// STATE\n\t// ========================================================================\n\n\tconst [view, setViewState] = useState<TCalendarView>(initialView);\n\tconst [currentDate, setCurrentDateState] = useState<Date>(() => initialDate ?? new Date());\n\tconst [filters, setFiltersState] = useState<ICalendarFilters>(initialFilters);\n\tconst [preferences, setPreferencesState] = useState<ICalendarPreferences>(() => ({\n\t\t...DEFAULT_PREFERENCES,\n\t\t...userPreferences,\n\t\t...lockedPreferences,\n\t}));\n\n\t// ========================================================================\n\t// COMPUTED\n\t// ========================================================================\n\n\tconst dateRange = useMemo(\n\t\t() => getViewDateRange(currentDate, view, preferences.firstDayOfWeek),\n\t\t[currentDate, view, preferences.firstDayOfWeek]\n\t);\n\n\tconst viewTitle = useMemo(\n\t\t() => getViewTitle(currentDate, view, locale),\n\t\t[currentDate, view, locale]\n\t);\n\n\tconst filteredEvents = useMemo(() => {\n\t\tlet result = [...events];\n\n\t\t// Filter by date range\n\t\tresult = filterEventsByDateRange(result, dateRange.startDate, dateRange.endDate);\n\n\t\t// Filter by schedule types\n\t\tconst scheduleTypeIds = filters.scheduleTypeIds;\n\t\tif (scheduleTypeIds && scheduleTypeIds.length > 0) {\n\t\t\tresult = filterEventsByScheduleType(result, scheduleTypeIds);\n\t\t}\n\n\t\t// Filter by resources\n\t\tconst resourceIds = filters.resourceIds;\n\t\tif (resourceIds && resourceIds.length > 0) {\n\t\t\tresult = filterEventsByResource(result, resourceIds);\n\t\t}\n\n\t\t// Filter by search\n\t\tconst search = filters.search;\n\t\tif (search) {\n\t\t\tresult = filterEventsBySearch(result, search);\n\t\t}\n\n\t\t// Filter canceled\n\t\tif (!preferences.showCanceledEvents) {\n\t\t\tresult = filterOutCanceled(result);\n\t\t}\n\n\t\t// Sort by start date\n\t\treturn sortEventsByStart(result);\n\t}, [events, dateRange, filters, preferences.showCanceledEvents]);\n\n\t// ========================================================================\n\t// ACTIONS\n\t// ========================================================================\n\n\tconst setView = useCallback(\n\t\t(newView: TCalendarView) => {\n\t\t\tsetViewState(newView);\n\t\t\tonViewChange?.(newView);\n\t\t},\n\t\t[onViewChange]\n\t);\n\n\tconst setCurrentDate = useCallback(\n\t\t(date: Date) => {\n\t\t\tsetCurrentDateState(date);\n\t\t\tonDateChange?.(date);\n\t\t},\n\t\t[onDateChange]\n\t);\n\n\tconst goToNext = useCallback(() => {\n\t\tconst newDate = navigateNext(currentDate, view);\n\t\tsetCurrentDate(newDate);\n\t}, [currentDate, view, setCurrentDate]);\n\n\tconst goToPrev = useCallback(() => {\n\t\tconst newDate = navigatePrev(currentDate, view);\n\t\tsetCurrentDate(newDate);\n\t}, [currentDate, view, setCurrentDate]);\n\n\tconst goToToday = useCallback(() => {\n\t\tsetCurrentDate(navigateToday());\n\t}, [setCurrentDate]);\n\n\tconst goToDate = useCallback(\n\t\t(date: Date) => {\n\t\t\tsetCurrentDate(date);\n\t\t},\n\t\t[setCurrentDate]\n\t);\n\n\t// ========================================================================\n\t// FILTERS\n\t// ========================================================================\n\n\tconst setFilters = useCallback(\n\t\t(newFilters: ICalendarFilters) => {\n\t\t\tsetFiltersState(newFilters);\n\t\t\tonFiltersChange?.(newFilters);\n\t\t},\n\t\t[onFiltersChange]\n\t);\n\n\tconst updateFilters = useCallback(\n\t\t(updates: Partial<ICalendarFilters>) => {\n\t\t\tsetFiltersState((prev) => {\n\t\t\t\tconst next = { ...prev, ...updates };\n\t\t\t\tonFiltersChange?.(next);\n\t\t\t\treturn next;\n\t\t\t});\n\t\t},\n\t\t[onFiltersChange]\n\t);\n\n\tconst clearFilters = useCallback(() => {\n\t\tconst emptyFilters: ICalendarFilters = {};\n\t\tsetFiltersState(emptyFilters);\n\t\tonFiltersChange?.(emptyFilters);\n\t}, [onFiltersChange]);\n\n\t// ========================================================================\n\t// PREFERENCES\n\t// ========================================================================\n\n\tconst setPreferences = useCallback(\n\t\t(prefs: Partial<ICalendarPreferences>) => {\n\t\t\tsetPreferencesState((prev) => ({\n\t\t\t\t...prev,\n\t\t\t\t...prefs,\n\t\t\t\t...lockedPreferences, // Locked prefs always override\n\t\t\t}));\n\t\t},\n\t\t[lockedPreferences]\n\t);\n\n\t// ========================================================================\n\t// EVENT HANDLERS\n\t// ========================================================================\n\n\tconst handleEventClick = useCallback(\n\t\t(event: CalendarEvent<TEventData>) => {\n\t\t\tonEventClick?.(event);\n\t\t},\n\t\t[onEventClick]\n\t);\n\n\tconst handleSlotSelect = useCallback(\n\t\t(selection: ISelectionResult) => {\n\t\t\tonSlotSelect?.(selection);\n\t\t},\n\t\t[onSlotSelect]\n\t);\n\n\t// ========================================================================\n\t// RETURN\n\t// ========================================================================\n\n\treturn {\n\t\t// State\n\t\tview,\n\t\tcurrentDate,\n\t\tdateRange,\n\t\tfilters,\n\t\tpreferences,\n\n\t\t// Computed\n\t\tfilteredEvents,\n\t\tviewTitle,\n\n\t\t// Data\n\t\tevents,\n\t\tresources,\n\t\tscheduleTypes,\n\n\t\t// Actions\n\t\tsetView,\n\t\tsetCurrentDate,\n\t\tgoToNext,\n\t\tgoToPrev,\n\t\tgoToToday,\n\t\tgoToDate,\n\n\t\t// Filters\n\t\tsetFilters,\n\t\tupdateFilters,\n\t\tclearFilters,\n\n\t\t// Preferences\n\t\tsetPreferences,\n\n\t\t// Event handlers\n\t\thandleEventClick,\n\t\thandleSlotSelect,\n\t};\n}\n"],"names":["CalendarContext","createContext","CalendarProvider","children","value","jsx","useCalendarContext","context","useContext","useOptionalCalendarContext","useCalendarView","view","setView","useCalendarDate","currentDate","setCurrentDate","goToNext","goToPrev","goToToday","goToDate","useCalendarEvents","events","filteredEvents","useCalendarFilters","filters","setFilters","updateFilters","clearFilters","useCalendarPreferences","preferences","setPreferences","PREFERENCES_STORAGE_KEY","DEFAULT_VISIBLE_HOURS","DEFAULT_WORKING_HOURS","DEFAULT_SLOT_DURATION","SYSTEM_DEFAULTS","loadFromStorage","key","stored","parsed","sanitized","saveToStorage","config","modes","locked","defaults","storageKey","disableStorage","effectiveDefaults","useMemo","storedPreferences","setStoredPreferences","useState","sessionPreferences","setSessionPreferences","useEffect","getMode","useCallback","isLocked","isPersisted","result","mode","setPreference","prev","updates","sessionUpdates","storedUpdates","resetPreferences","resetPreference","_","rest","InnoCalendarContext","InnoCalendarProvider","initialEvents","initialUsers","initialScheduleTypes","initialView","initialDate","initialSelectedUserId","initialScheduleTypeIds","initialParticipantIds","initialWorkingHoursView","initialSearchQuery","preferencesConfig","onDateChange","onViewChange","setViewInternal","selectedDate","setSelectedDateInternal","selectedUserId","setSelectedUserId","badgeVariant","setBadgeVariant","variant","workingHours","setWorkingHours","action","current","newValue","prefVisibleHours","visibleHours","setVisibleHours","showWorkingHoursOnlyState","setShowWorkingHoursOnlyState","showWorkingHoursOnly","setShowWorkingHoursOnly","show","slotDuration","setSlotDuration","duration","setEvents","selectedScheduleTypeIds","setSelectedScheduleTypeIds","selectedParticipantIds","_setSelectedParticipantIds","searchQuery","setSearchQuery","newView","setSelectedDate","newDate","forView","event","query","p","useInnoCalendar","useOptionalInnoCalendar","useInnoCalendarView","useInnoCalendarEvents","useInnoCalendarFilters","useInnoCalendarTimeConfig","useCalendar","options","resources","scheduleTypes","initialFilters","userPreferences","lockedPreferences","locale","onEventClick","onSlotSelect","onFiltersChange","setViewState","setCurrentDateState","setFiltersState","setPreferencesState","DEFAULT_PREFERENCES","dateRange","getViewDateRange","viewTitle","getViewTitle","filterEventsByDateRange","scheduleTypeIds","filterEventsByScheduleType","resourceIds","filterEventsByResource","search","filterEventsBySearch","filterOutCanceled","sortEventsByStart","date","navigateNext","navigatePrev","navigateToday","newFilters","next","emptyFilters","prefs","handleEventClick","handleSlotSelect","selection"],"mappings":"+FAmBMA,EAAkBC,EAAAA,cAA4D,MAAS,EAetF,SAASC,GAId,CAAE,SAAAC,EAAU,MAAAC,GAA8E,CAC3F,OAAOC,GAAAA,IAACL,EAAgB,SAAhB,CAAyB,MAAAI,EAAe,SAAAD,CAAA,CAAS,CAC1D,CASO,SAASG,GAIqD,CACpE,MAAMC,EAAUC,EAAAA,WAAWR,CAAe,EAC1C,GAAI,CAACO,EACJ,MAAM,IAAI,MAAM,2DAA2D,EAE5E,OAAOA,CACR,CAKO,SAASE,IAIiE,CAEhF,OADgBD,EAAAA,WAAWR,CAAe,CAE3C,CASO,SAASU,IAAkB,CACjC,KAAM,CAAE,KAAAC,EAAM,QAAAC,CAAA,EAAYN,EAAA,EAC1B,MAAO,CAAE,KAAAK,EAAM,QAAAC,CAAA,CAChB,CAKO,SAASC,IAAkB,CACjC,KAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,SAAAC,EAAU,SAAAC,EAAU,UAAAC,EAAW,SAAAC,CAAA,EACnEb,EAAA,EACD,MAAO,CAAE,YAAAQ,EAAa,eAAAC,EAAgB,SAAAC,EAAU,SAAAC,EAAU,UAAAC,EAAW,SAAAC,CAA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AA,EAGR8B,EAAmB/G,EAAAA,YACvBgH,GAAgC,CAChC9B,IAAe8B,CAAS,CACzB,EACA,CAAC9B,CAAY,CAAA,EAOd,MAAO,CAEN,KAAAhI,EACA,YAAAG,EACA,UAAAoI,EACA,QAAA1H,EACA,YAAAK,EAGA,eAAAP,EACA,UAAA8H,EAGA,OAAA/H,EACA,UAAA+G,EACA,cAAAC,EAGA,QAAAzH,EACA,eAAAG,EACA,SAAAC,EACA,SAAAC,EACA,UAAAC,EACA,SAAAC,EAGA,WAAAM,EACA,cAAAC,EACA,aAAAC,EAGA,eAAAG,EAGA,iBAAAyI,EACA,iBAAAC,CAAA,CAEF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),a=require("react"),d=require("./index-D2U2F80P.cjs"),st=require("@radix-ui/react-dropdown-menu"),g=require("./utils.cjs"),de=require("./slot-selection-context-Bx3FKJfR.cjs"),rt=require("@radix-ui/react-popover"),ot=require("@radix-ui/react-tooltip");function Ne(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 ee=Ne(a),V=Ne(st),le=Ne(rt),pe=Ne(ot),Z=le.Root,Q=le.Trigger,at=le.Anchor,X=ee.forwardRef(({className:t,align:n="center",sideOffset:s=4,...r},o)=>e.jsx(le.Portal,{children:e.jsx(le.Content,{ref:o,align:n,sideOffset:s,className:d.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})}));X.displayName=le.Content.displayName;const it=pe.Provider,te=pe.Root,ne=pe.Trigger,J=ee.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(pe.Content,{ref:r,sideOffset:n,className:d.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}));J.displayName=pe.Content.displayName;function se(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 Fe(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function he({event:t,variant:n="full",badgeVariant:s="colored",onClick:r,className:o,showTime:p=!0,showDescription:i=!1,showParticipants:y=!1,style:v,disablePopover:l=!1,renderPopover:b,enableDrag:w=!1,enablePageTransition:x=!1,pageTransitionDuration:f=400}){const u=se(t.color),[j,N]=a.useState(!1),[_,M]=a.useState(!1),[E,I]=a.useState(!1),[A,W]=a.useState(null),S=a.useRef(null),R=de.useOptionalDragDrop(),B=t.endDate<Fe(new Date),z=t.isCanceled??!1,G=w&&R&&!z&&!B,D=t.data,m=D?.meetingTookPlace??t.meetingTookPlace??!1,L=z?e.jsx(dt,{className:"h-3 w-3 text-zinc-800 dark:text-zinc-200"}):m?e.jsx(lt,{className:d.cn("h-3 w-3",u.text)}):null,H=t.scheduleTypeName||D?.scheduleTypeName||D?.typeName,P=D?.productName,k=D?.nrParticipant,c=D?.siteName,h=D?.siteCity,C=[c,h].filter(Boolean).join(", "),$=a.useCallback(()=>{if(!_){if(l&&r){r(t);return}if(x&&S.current){const q=S.current.getBoundingClientRect();W(q),I(!0)}else l||N(!0)}},[_,l,r,t,x]);a.useCallback(()=>{I(!1),W(null),l||N(!0)},[l]);const T=a.useCallback(()=>{N(!1)},[]),K=a.useCallback(q=>{G&&(q.dataTransfer.effectAllowed="move",q.dataTransfer.setData("text/plain",t.id),M(!0),R?.startDrag?.(t))},[G,t,R]),O=a.useCallback(()=>{M(!1),R?.isDragging&&R.endDrag?.()},[R]);if(n==="dot"){const q=e.jsx("button",{type:"button",onClick:$,className:d.cn("size-2 rounded-full cursor-pointer transition-opacity",u.dot,t.isCanceled&&"opacity-50",o),style:v,"aria-label":t.title});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:q}),e.jsx(J,{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:g.formatEventTimeDisplay(t)})]})})]}):e.jsxs(Z,{open:j,onOpenChange:N,children:[e.jsx(Q,{asChild:!0,children:e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:q}),e.jsx(J,{children:e.jsx("div",{className:"font-medium",children:t.title})})]})}),e.jsx(X,{className:"w-80",children:b?b({event:t,onClose:T}):e.jsx(me,{event:t,onClose:T})})]})}if(n==="compact"){const q=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!G,onDragStart:K,onDragEnd:O,onClick:l?$:void 0,onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),$())},className:d.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",G?"cursor-grab active:cursor-grabbing":"cursor-pointer",_&&"opacity-50",z?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 line-through":[s==="colored"&&[u.bg,u.text],s==="mixed"&&[u.bg,u.text],s==="dot"&&"bg-muted/50"],o),style:v,children:[["dot","mixed"].includes(s)&&!z&&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:u.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:d.cn("w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",u.border),children:g.formatEventTimeDisplay(t)})]})}),e.jsx("div",{className:"flex gap-0.5",children:L})]});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:q}),e.jsx(J,{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:g.formatEventTimeDisplay(t)})]})})]}):e.jsxs(Z,{open:j,onOpenChange:N,children:[e.jsx(Q,{asChild:!0,children:q}),e.jsx(X,{className:"w-80",children:b?b({event:t,onClose:T}):e.jsx(me,{event:t,onClose:T})})]})}const F=e.jsxs("button",{type:"button",onClick:$,className:d.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",z?"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"&&[u.bg,u.accentBorder,u.text],s==="mixed"&&[u.bg,u.accentBorder,u.text],s==="dot"&&"bg-muted/50 border-l-neutral-400 dark:border-l-neutral-600"],o),style:v,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)&&!z&&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:u.dotFill})}),e.jsxs("span",{className:d.cn("text-sm font-medium truncate",!z&&s!=="dot"&&u.text,z&&"line-through"),children:[t.title,H&&e.jsxs("span",{className:"font-normal opacity-75",children:[" ","- ",H]})]})]}),L]}),P&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:P}),k!=null&&k>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Se,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[k," participant",k!==1?"s":""]})]}),p&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ee,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:g.formatEventTimeDisplay(t)})]}),C&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(qe,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:C})]}),i&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),y&&t.participants&&t.participants.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Se,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.participants.map(q=>q.name).join(", ")})]})]});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:F}),e.jsx(J,{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:g.formatEventTimeDisplay(t)})]})})]}):e.jsxs(Z,{open:j,onOpenChange:N,children:[e.jsx(Q,{asChild:!0,children:F}),e.jsx(X,{className:"w-80",children:b?b({event:t,onClose:T}):e.jsx(me,{event:t,onClose:T})})]})}function Ee({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 lt({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 dt({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 Se({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 qe({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 me({event:t,onClose:n}){const s=se(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:d.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:d.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(Ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"tabular-nums",children:g.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 Le({event:t,position:n,hourHeight:s=96,badgeVariant:r="colored",onClick:o,className:p,disablePopover:i=!1,renderPopover:y,enableDrag:v=!0}){const l=se(t.color),[b,w]=a.useState(!1),[x,f]=a.useState(!1),u=de.useOptionalDragDrop(),j=(t.endDate.getTime()-t.startDate.getTime())/(1e3*60),N=j/60*s-8,_=t.endDate<Fe(new Date),M=t.isCanceled??!1,E=v&&u&&!M&&!_,I=j<35,A=j>25,W=j>=45,S=t.data,R=t.scheduleTypeName||S?.scheduleTypeName||S?.typeName,B=S?.productName,z=S?.nrParticipant,G=S?.siteName,D=S?.siteCity,m=[G,D].filter(Boolean).join(", "),L=r==="dot",H=a.useCallback(()=>{x||(i&&o?o(t):i||w(!0))},[x,i,o,t]),P=a.useCallback(()=>{w(!1)},[]),k=a.useCallback(T=>{if(!E)return;T.dataTransfer.effectAllowed="move",T.dataTransfer.setData("text/plain",t.id);const K=T.currentTarget,O=K.getBoundingClientRect();T.dataTransfer.setDragImage(K,T.clientX-O.left,T.clientY-O.top),f(!0),u?.startDrag?.(t)},[E,t,u]),c=a.useCallback(()=>{f(!1),u?.isDragging&&u.endDrag?.()},[u]),h=a.useCallback(T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),H())},[H]),C=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!E,onDragStart:k,onDragEnd:c,onKeyDown:h,onClick:x?void 0:H,className:d.cn("group flex w-full select-none flex-col gap-0.5 overflow-hidden rounded-md border-l-[3px] px-2 py-1.5 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",E?"cursor-grab active:cursor-grabbing":"cursor-pointer",x&&"opacity-50",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":[!L&&[l.bg,l.accentBorder,l.text],L&&"bg-neutral-50 dark:bg-neutral-900 border-l-neutral-400 dark:border-l-neutral-600"],I&&"py-0 justify-center",p),style:{height:`${Math.max(N,20)}px`},children:[e.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[["mixed","dot"].includes(r)&&!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:l.dotFill})}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsxs("p",{className:d.cn("font-semibold truncate leading-tight",!M&&L&&"text-foreground"),children:[t.title,R&&e.jsxs("span",{className:"font-normal opacity-75",children:[" ","- ",R]})]})})]}),W&&B&&e.jsx("p",{className:d.cn("text-[11px] truncate leading-tight",L?"text-muted-foreground":"opacity-80"),children:B}),z!=null&&z>0&&e.jsxs("div",{className:d.cn("flex items-center gap-1 text-[11px] leading-tight",L?"text-muted-foreground":"opacity-80"),children:[e.jsx(Se,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[z," participant",z!==1?"s":""]})]}),A&&e.jsxs("div",{className:d.cn("flex items-center gap-1 text-[11px] tabular-nums leading-tight",L?"text-muted-foreground":"opacity-90"),children:[e.jsx(Ee,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:g.formatEventTimeDisplay(t)})]}),W&&m&&e.jsxs("div",{className:d.cn("flex items-center gap-1 text-[11px] truncate leading-tight",L?"text-muted-foreground":"opacity-80"),children:[e.jsx(qe,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:m})]})]}),$=e.jsx(J,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"font-medium",children:[t.title,R&&e.jsxs("span",{className:"font-normal opacity-75",children:[" ","- ",R]})]}),B&&e.jsx("div",{className:"text-xs text-muted-foreground",children:B}),z!=null&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[z," participant",z!==1?"s":""]}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:g.formatEventTimeDisplay(t)}),m&&e.jsx("div",{className:"text-xs text-muted-foreground",children:m})]})});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:C}),$]})}):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(Z,{open:b,onOpenChange:w,children:[e.jsx(Q,{asChild:!0,children:C}),e.jsx(X,{className:"w-80",children:y?y({event:t,onClose:P}):e.jsx(me,{event:t,onClose:P})})]})})}function ct({event:t,spanDays:n,isStart:s,isEnd:r,onClick:o,className:p,disablePopover:i=!1,renderPopover:y}){const v=se(t.color),[l,b]=a.useState(!1),w=t.isCanceled??!1,x=a.useCallback(()=>{i&&o?o(t):i||b(!0)},[i,o,t]),f=a.useCallback(()=>{b(!1)},[]),u=e.jsx("button",{type:"button",onClick:x,className:d.cn("flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",w?"bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[v.dot,"text-white"],s&&"rounded-l",r&&"rounded-r",!s&&"border-l-0",!r&&"border-r-0",p),style:{width:`${n*100}%`},children:s&&e.jsx("span",{className:"truncate",children:t.title})}),j=e.jsx(J,{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:g.formatEventTimeDisplay(t)})]})});return i?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:u}),j]}):e.jsxs(Z,{open:l,onOpenChange:b,children:[e.jsx(Q,{asChild:!0,children:u}),e.jsx(X,{className:"w-80",children:y?y({event:t,onClose:f}):e.jsx(me,{event:t,onClose:f})})]})}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 ze=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Be=d.clsx,Ge=(t,n)=>s=>{var r;if(n?.variants==null)return Be(t,s?.class,s?.className);const{variants:o,defaultVariants:p}=n,i=Object.keys(o).map(l=>{const b=s?.[l],w=p?.[l];if(b===null)return null;const x=ze(b)||ze(w);return o[l][x]}),y=s&&Object.entries(s).reduce((l,b)=>{let[w,x]=b;return x===void 0||(l[w]=x),l},{}),v=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((l,b)=>{let{class:w,className:x,...f}=b;return Object.entries(f).every(u=>{let[j,N]=u;return Array.isArray(N)?N.includes({...p,...y}[j]):{...p,...y}[j]===N})?[...l,w,x]:l},[]);return Be(t,i,v,s?.class,s?.className)},Ue=Ge("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"}}),oe=a.forwardRef(({className:t,variant:n,size:s,loading:r,disabled:o,children:p,...i},y)=>e.jsxs("button",{className:d.cn(Ue({variant:n,size:s,className:t})),ref:y,disabled:o||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"})]}),p]}));oe.displayName="Button";const Ke=(...t)=>t.filter((n,s,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===s).join(" ").trim();const ut=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const xt=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,s,r)=>r?r.toUpperCase():s.toLowerCase());const Re=t=>{const n=xt(t);return n.charAt(0).toUpperCase()+n.slice(1)};var mt={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 ht=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const pt=a.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:o="",children:p,iconNode:i,...y},v)=>a.createElement("svg",{ref:v,...mt,width:n,height:n,stroke:t,strokeWidth:r?Number(s)*24/Number(n):s,className:Ke("lucide",o),...!p&&!ht(y)&&{"aria-hidden":"true"},...y},[...i.map(([l,b])=>a.createElement(l,b)),...Array.isArray(p)?p:[p]]));const Ae=(t,n)=>{const s=a.forwardRef(({className:r,...o},p)=>a.createElement(pt,{ref:p,iconNode:n,className:Ke(`lucide-${ut(Re(t))}`,`lucide-${t}`,r),...o}));return s.displayName=Re(t),s};const ft=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],gt=Ae("check",ft);const yt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bt=Ae("chevron-right",yt);const jt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wt=Ae("circle",jt),Me=V.Root,Te=V.Trigger,vt=ee.forwardRef(({className:t,inset:n,children:s,...r},o)=>e.jsxs(V.SubTrigger,{ref:o,className:d.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(bt,{className:"ml-auto h-4 w-4"})]}));vt.displayName=V.SubTrigger.displayName;const Nt=ee.forwardRef(({className:t,...n},s)=>e.jsx(V.SubContent,{ref:s,className:d.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}));Nt.displayName=V.SubContent.displayName;const je=ee.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(V.Portal,{children:e.jsx(V.Content,{ref:r,sideOffset:n,className:d.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})}));je.displayName=V.Content.displayName;const we=ee.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(V.Item,{ref:r,className:d.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}));we.displayName=V.Item.displayName;const kt=ee.forwardRef(({className:t,children:n,checked:s=!1,...r},o)=>e.jsxs(V.CheckboxItem,{ref:o,className:d.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(V.ItemIndicator,{children:e.jsx(gt,{className:"h-4 w-4"})})}),n]}));kt.displayName=V.CheckboxItem.displayName;const Dt=ee.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(V.RadioItem,{ref:r,className:d.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(V.ItemIndicator,{children:e.jsx(wt,{className:"h-2 w-2 fill-current"})})}),n]}));Dt.displayName=V.RadioItem.displayName;const Ct=ee.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(V.Label,{ref:r,className:d.cn("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...s}));Ct.displayName=V.Label.displayName;const St=ee.forwardRef(({className:t,...n},s)=>e.jsx(V.Separator,{ref:s,className:d.cn("-mx-1 my-1 h-px bg-muted",t),...n}));St.displayName=V.Separator.displayName;const Mt=Ge("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 Xe({className:t,variant:n,...s}){return e.jsx("div",{className:d.cn(Mt({variant:n}),t),...s})}function Tt({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 Et({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 Lt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Ye({date:t,view:n,events:s=[],onNavigatePrev:r,onNavigateNext:o,weekStartsOn:p=1,showEventCount:i=!0,className:y}){const v=Lt[t.getMonth()],l=t.getFullYear(),b=i?g.getEventsCountInView(s,t,n,p):0,w=g.getRangeText(t,n);return e.jsxs("div",{className:d.cn("min-w-0 flex-1",y),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:[v," ",l]}),i&&e.jsx(Xe,{variant:"outline",className:"px-1 sm:px-1.5 text-[10px] sm:text-xs shrink-0",children:b})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsx(oe,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:r,children:e.jsx(Tt,{})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:w}),e.jsx(oe,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:o,children:e.jsx(Et,{})})]})]})}const At=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function Je({onClick:t,className:n}){const s=new Date;return e.jsxs("button",{type:"button",className:d.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:At[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 Wt({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 ie({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 $e({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 _t({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 He({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 zt({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 Bt({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 Rt({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 $t({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 Ht=[{value:"day",label:"Day",icon:zt},{value:"week",label:"Week",icon:Bt},{value:"month",label:"Month",icon:Rt},{value:"year",label:"Year",icon:$t}],Ie=[{value:"timeline-day",label:"1 Day",icon:ie},{value:"timeline-3day",label:"3 Days",icon:ie},{value:"timeline-week",label:"7 Days",icon:ie}],It=[{value:"resource-day",label:"1 Day",icon:ie},{value:"resource-week",label:"7 Days",icon:ie}];function Ot({currentDate:t,view:n,events:s=[],onNavigateToday:r,onNavigatePrev:o,onNavigateNext:p,onNavigate:i,onViewChange:y,onAddEvent:v,availableViews:l=["day","week","month","agenda"],showTimelineViews:b=!1,timelineViews:w,settingsContent:x,showSettings:f=!1,filterContent:u,actions:j,className:N,weekStartsOn:_=1,labels:M={}}){const E=a.useMemo(()=>({today:"Today",addEvent:"Add Event",calendarView:"Calendar View",resourceView:"Resource View",...M}),[M]),I=()=>{r?.(),i?.("today")},A=()=>{o?.(),i?.("prev")},W=()=>{p?.(),i?.("next")},S=["day","week","month","year","agenda"].includes(n),R=n.startsWith("timeline-")||n.startsWith("resource-"),B=Ht.filter(m=>l.includes(m.value)),z=S?B.find(m=>m.value===n):null,G=[...Ie,...It],D=R?G.find(m=>m.value===n):null;return e.jsxs("div",{className:d.cn("flex flex-col w-full gap-3 mb-2",N),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:[e.jsx(Je,{onClick:I}),e.jsx(Ye,{date:t,view:n,events:s,onNavigatePrev:A,onNavigateNext:W,weekStartsOn:_})]}),v&&e.jsx(oe,{size:"icon",className:"shrink-0 lg:hidden",onClick:v,children:e.jsx(He,{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:[y&&B.length>0&&e.jsxs(Me,{children:[e.jsxs(Te,{className:d.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",S?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-input bg-background hover:bg-accent hover:text-accent-foreground"),children:[e.jsx(Wt,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:z?.label??E.calendarView}),e.jsx($e,{className:"size-3 opacity-60"})]}),e.jsx(je,{align:"start",className:"min-w-[120px]",children:B.map(m=>{const L=m.icon;return e.jsxs(we,{onClick:()=>y(m.value),className:d.cn("gap-2",n===m.value&&"bg-accent"),children:[e.jsx(L,{className:"size-4"}),e.jsx("span",{children:m.label})]},m.value)})})]}),b&&y&&e.jsxs(Me,{children:[e.jsxs(Te,{className:d.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",R?"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(ie,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:D?.label??E.resourceView}),e.jsx($e,{className:"size-3 opacity-60"})]}),e.jsx(je,{align:"start",className:"min-w-[120px]",children:Ie.map(m=>{const L=m.icon;return e.jsxs(we,{onClick:()=>y(m.value),className:d.cn("gap-2",n===m.value&&"bg-accent"),children:[e.jsx(L,{className:"size-4"}),e.jsx("span",{children:m.label})]},m.value)})})]}),f&&x&&e.jsxs(Z,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(oe,{variant:"outline",size:"icon",className:"min-w-10 min-h-10 shrink-0 mx-0",children:e.jsx(_t,{className:"size-4 sm:size-5"})})}),e.jsx(X,{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:x})})]}),j,v&&e.jsxs(oe,{className:"hidden lg:flex shrink-0 max-h-10",onClick:v,children:[e.jsx(He,{className:"size-4"}),E.addEvent]})]})]}),u&&e.jsx("div",{className:"flex items-center gap-2 pb-1 -mb-1 scrollbar-none",children:u})]})}function Pt({events:t,date:n,daysAhead:s=60,badgeVariant:r="colored",onEventClick:o,className:p,renderEvent:i,renderPopover:y,slots:v,classNames:l}){const b=a.useMemo(()=>{const x=new Date(n);x.setHours(0,0,0,0);const f=new Date(x);return f.setDate(f.getDate()+s),t.filter(u=>u.endDate>=x&&u.startDate<=f)},[t,s,n]),w=a.useMemo(()=>{const x=g.groupEventsByDate(b),f=[];for(const[u,j]of x)f.push({date:new Date(u),dateKey:u,events:j});return f.sort((u,j)=>u.date.getTime()-j.date.getTime()),f},[b]);return w.length===0?e.jsx("div",{className:d.cn("flex flex-col items-center justify-center h-full py-12",p),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:d.cn("flex flex-col h-full overflow-auto",l?.agendaList,p),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:[b.length," event",b.length!==1?"s":""]})]})}),e.jsx("div",{className:"flex-1",children:w.map(({date:x,dateKey:f,events:u})=>{const j=g.isToday(x),N=x.toLocaleDateString([],{weekday:"short"}),_=x.getDate(),M=x.toLocaleDateString([],{month:"short"});return e.jsxs("div",{className:d.cn("",l?.agendaDayGroup),children:[e.jsx("div",{className:d.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:d.cn("text-[11px] font-medium uppercase tracking-wide",j?"text-primary":"text-muted-foreground"),children:N}),e.jsx("span",{className:d.cn("flex items-center justify-center rounded-full mt-0.5","size-10 text-xl font-normal",j?"bg-primary text-primary-foreground":"text-foreground"),children:_})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[M," ",x.getFullYear()]})]})}),e.jsx("div",{className:"px-4 py-3 space-y-2 border-b last:border-b-0",children:u.map(E=>i?e.jsx("div",{children:i({event:E,variant:"full"})},E.id):e.jsx(he,{event:E,variant:"full",badgeVariant:r,onClick:o,disablePopover:!!o&&!y,renderPopover:y,showTime:!0,showDescription:!0,showParticipants:!0,...l?.eventCard&&{className:l.eventCard}},E.id))})]},f)})})]})}const fe=360,ge=480,ke=280;function Ze({isOpen:t,onClose:n,date:s,events:r,anchorRect:o,badgeVariant:p="colored",onEventClick:i,renderEvent:y,renderPopover:v,className:l}){const b=a.useRef(null),w=a.useRef(null),[x,f]=a.useState("closed"),u=a.useMemo(()=>[...r].sort((A,W)=>A.startDate.getTime()-W.startDate.getTime()),[r]),j=a.useMemo(()=>{if(!o)return{top:0,left:0,width:fe,maxHeight:ge};const A=typeof window<"u"?window.innerWidth:1200,W=typeof window<"u"?window.innerHeight:800;let S=o.left+o.width/2-fe/2;S=Math.max(16,Math.min(S,A-fe-16));const R=Math.min(r.length*68+80,ge);let B=o.top+o.height/2-R/2;return B=Math.max(16,Math.min(B,W-R-16)),{top:B,left:S,width:fe,maxHeight:ge}},[o,r.length]);a.useLayoutEffect(()=>{if(t&&o)f("entering"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{f("open")})});else if(!t&&x==="open"){f("exiting");const A=setTimeout(()=>{f("closed")},ke);return()=>clearTimeout(A)}},[t,o]),a.useEffect(()=>{if(x==="closed")return;const A=W=>{W.key==="Escape"&&(W.stopPropagation(),n())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[x,n]),a.useEffect(()=>{x==="open"&&w.current&&w.current.focus()},[x]);const N=a.useCallback(A=>{A.target===b.current&&n()},[n]);if(x==="closed")return null;const _=x==="entering"||x==="exiting",M=_&&o?{position:"fixed",top:o.top,left:o.left,width:o.width,height:o.height,maxHeight:o.height,opacity:x==="entering"?.7:0,transform:"scale(1)",borderRadius:"8px"}:{position:"fixed",top:j.top,left:j.left,width:j.width,maxHeight:j.maxHeight,opacity:1,transform:"scale(1)",borderRadius:"12px"},E=_?0:1,I=s.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"});return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:b,role:"presentation",onClick:N,className:"ic-expansion-backdrop",style:{position:"fixed",inset:0,zIndex:50,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:E,transition:`opacity ${ke}ms cubic-bezier(0.32, 0.72, 0, 1)`}}),e.jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-label":`Events for ${I}`,tabIndex:-1,className:d.cn("ic-expansion-panel","bg-background border border-border shadow-2xl overflow-hidden","focus:outline-none",l),style:{...M,zIndex:51,transition:`all ${ke}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:I}),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:`${ge-64}px`},children:[u.map(A=>e.jsx("div",{onPointerDown:W=>W.stopPropagation(),children:y?y({event:A,variant:"compact"}):e.jsx(he,{event:A,variant:"compact",badgeVariant:p,onClick:W=>{n(),i?.(W)},disablePopover:!!i&&!v,renderPopover:v,showTime:!0})},A.id)),r.length===0&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No events"})]})]})]})}function Vt({event:t,date:n,onEventClick:s,disablePopover:r,renderPopover:o}){const[p,i]=a.useState(!1),y=se(t.color),v=g.detectAllDayEvent(t),l=g.isSameDay(t.startDate,n),b=g.isSameDay(t.endDate,n),w=v&&g.isSameDay(t.startDate,t.endDate),x=a.useCallback(()=>{r&&s?s(t):r||i(!0)},[r,s,t]),f=a.useCallback(()=>{i(!1)},[]),u=e.jsxs("button",{type:"button",onClick:x,title:g.formatEventTimeDisplay(t),className:d.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",y.bg,y.text,t.isCanceled&&"opacity-60 line-through"),children:[!w&&l&&!b&&"→ ",!w&&!l&&b&&" ←",!w&&!l&&!b&&"↔ ",e.jsx("span",{className:"truncate max-w-24 sm:max-w-32",children:t.title}),w&&e.jsx("span",{className:"text-[9px] opacity-70 sm:text-[10px]",children:"All day"})]}),j=e.jsx(J,{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:g.formatEventTimeDisplay(t)})]})});return r?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:u}),j]}):e.jsxs(Z,{open:p,onOpenChange:i,children:[e.jsx(Q,{asChild:!0,children:u}),e.jsx(X,{className:"w-80",children:o?o({event:t,onClose:f}):e.jsx(Ft,{event:t,onClose:f})})]})}function Ft({event:t,onClose:n}){const s=se(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:d.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:d.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:g.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 Qe({events:t,date:n,onEventClick:s,disablePopover:r=!1,renderPopover:o,className:p}){if(t.length===0)return null;const i=t.some(l=>g.detectAllDayEvent(l)&&g.isSameDay(l.startDate,l.endDate)),y=t.some(l=>!g.isSameDay(l.startDate,l.endDate)||g.detectAllDayEvent(l)&&!g.isSameDay(l.startDate,l.endDate)),v=i&&y?"All day / Multi-day":i?"All day":"Multi-day";return e.jsxs("div",{className:d.cn("border-b bg-muted/20 px-2 py-1.5 space-y-1","sm:px-4 sm:py-2",p),children:[e.jsx("span",{className:"text-[10px] font-medium text-muted-foreground sm:text-xs",children:v}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(l=>e.jsx(Vt,{event:l,date:n,onEventClick:s,disablePopover:r,renderPopover:o},l.id))})]})}const qt=5;function et({slot:t,onSelectionStart:n,onSelectionMove:s,onSelectionEnd:r,isSelected:o=!1,isSelecting:p=!1,disabled:i=!1,ariaLabel:y,children:v,className:l,height:b,style:w,dataAttributes:x}){const f=a.useRef(null),u=a.useRef(!1),j=a.useRef(!1),N=a.useRef(null),[_,M]=a.useState(!1),E=de.useOptionalDragDrop(),I=a.useCallback(D=>{i||D.button!==0&&D.pointerType==="mouse"||(D.preventDefault(),f.current={x:D.clientX,y:D.clientY},u.current=!1,j.current=!0,n?.(t))},[i,t,n]),A=a.useCallback(D=>{if(!(f.current&&j.current&&!i))return;const m=D.clientX-f.current.x,L=D.clientY-f.current.y;Math.sqrt(m*m+L*L)>=qt&&(u.current=!0)},[i]),W=a.useCallback(D=>{i||(D.buttons>0||p)&&s?.(t)},[i,p,t,s]),S=a.useCallback(()=>{i||(r?.(),f.current=null,u.current=!1,j.current=!1)},[i,r]),R=a.useCallback(D=>{if(!E?.isDragging||i)return;D.preventDefault(),D.dataTransfer.dropEffect="move",M(!0);const m=new Date,L=t.hour??m.getHours(),H=t.minute??(m.getMinutes()>=30?30:0);E.updateDragPreview?.(t.date,L,H)},[E,i,t]),B=a.useCallback(()=>{M(!1)},[]),z=a.useCallback(D=>{D.preventDefault(),M(!1),!(!E?.isDragging||i)&&E.endDrag?.()},[E,i]);a.useEffect(()=>{const D=()=>{j.current&&(j.current=!1,f.current=null,u.current=!1)};return window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),()=>{window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)}},[]);const G=a.useCallback(D=>{i||(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),n?.(t),r?.())},[i,t,n,r]);return e.jsx("button",{ref:N,type:"button","aria-label":y,"aria-disabled":i,"aria-pressed":o,disabled:i,onPointerDown:I,onPointerMove:A,onPointerUp:S,onPointerEnter:W,onKeyDown:G,onDragOver:R,onDragLeave:B,onDrop:z,className:d.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",!(p||i)&&"hover:bg-blue-50/60",o&&"bg-blue-100/70",_&&"bg-primary/20 ring-2 ring-primary ring-inset",i&&"cursor-not-allowed opacity-50",l),style:{height:b,...w},...x,children:v})}function We({slot:t,date:n,hour:s,minute:r,ariaLabel:o,...p}){const i=t??{date:n,hour:s??0,minute:r??0},y=o??`Add event at ${(i.hour??0).toString().padStart(2,"0")}:${(i.minute??0).toString().padStart(2,"0")} on ${i.date.toLocaleDateString()}`;return e.jsx(et,{slot:i,ariaLabel:y,...p})}function tt({slot:t,date:n,ariaLabel:s,...r}){const o=t??{date:n},p=s??`Select ${o.date.toLocaleDateString()}`;return e.jsx(et,{slot:o,ariaLabel:p,...r})}const ce=96,De=72,Ce=80;function Gt({events:t,date:n,visibleHours:s={startHour:0,endHour:24},workingHours:r,slotDuration:o=30,badgeVariant:p="colored",onEventClick:i,onSlotSelect:y,className:v,renderEvent:l,renderPopover:b,slots:w,classNames:x}){const f=60/o,u=100/f,j=a.useMemo(()=>{const k=[];for(let c=0;c<f;c++)k.push(c*o);return k},[f,o]),N=a.useMemo(()=>g.getEventsForDay(t,n),[t,n]),{singleDay:_,multiDay:M}=a.useMemo(()=>g.separateEventsByDuration(N),[N]),E=a.useMemo(()=>{const k=g.calculateOverlappingPositions(_,n,s,ce),c=new Map;for(const h of k)c.set(h.event.id,h.position);return c},[_,n,s]),I=a.useMemo(()=>g.getVisibleHoursArray(s),[s]),A=new Date,W=g.isToday(n),S=a.useMemo(()=>{if(!W)return 0;const k=A.getHours()+A.getMinutes()/60;return k<s.startHour||k>s.endHour?-1:(k-s.startHour)*ce},[W,s,A]),R=a.useRef(null);a.useLayoutEffect(()=>{const k=R.current;if(!k)return;const c=()=>{let h;if(W){const $=new Date().getHours();h=Math.max($-1,s.startHour)}else{const $=n.getDay(),T=r?.[$];T?.enabled&&T.from>0?h=Math.max(T.from-1,s.startHour):h=Math.max(7,s.startHour)}const C=(h-s.startHour)*ce;k.scrollTo({top:C,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(c)})},[n,r,s,W]);const B=de.useOptionalSlotSelection(),z=a.useCallback(k=>{B?.startSelection(k)},[B]),G=a.useCallback(k=>{B?.updateSelection(k)},[B]),D=a.useCallback(()=>{B?.endSelection()},[B]),m=a.useCallback(k=>{i?.(k)},[i]),L=n.toLocaleDateString([],{weekday:"short"}),H=n.getDate(),P=g.isToday(n);return e.jsxs("div",{className:d.cn("flex flex-col h-full",v),children:[e.jsx("div",{className:d.cn("flex items-center gap-3 border-b px-4 py-3",x?.columnHeader,P&&x?.columnHeaderToday),children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:d.cn("text-[11px] font-medium uppercase tracking-wide",P?"text-primary":"text-muted-foreground"),children:L}),e.jsx("span",{className:d.cn("flex items-center justify-center rounded-full mt-0.5","size-12 text-3xl font-normal",P?"bg-primary text-primary-foreground":"text-foreground"),children:H})]})}),M.length>0&&e.jsx(Qe,{events:M,date:n,onEventClick:m,disablePopover:!!i&&!b,renderPopover:b,...x?.multiDayBanner&&{className:x.multiDayBanner}}),e.jsx("div",{ref:R,className:d.cn("flex-1",x?.scrollContainer),children:e.jsxs("div",{className:"relative min-h-full",children:[I.map((k,c)=>{const C=!g.isWorkingHour(n,k,r);return e.jsxs("div",{className:d.cn("relative flex",C&&"bg-calendar-disabled-hour",x?.timeSlot,C?x?.timeSlotNonWorking:x?.timeSlotWorking),style:{height:ce},children:[e.jsx("div",{className:d.cn("relative flex-shrink-0 border-r border-border/50 bg-zinc-50 dark:bg-zinc-900",x?.timeGutter),style:{width:De},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:d.cn("text-[10px] sm:text-xs text-muted-foreground",x?.timeGutterLabel),children:g.formatHourLabel(k)})})}),e.jsxs("div",{className:"relative flex-1",children:[W&&!C&&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"}),j.slice(1).map($=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${$/60*100}%`}},$)),j.map(($,T)=>{const K={date:n,hour:k,minute:$};return e.jsx(We,{slot:K,onSelectionStart:z,onSelectionMove:G,onSelectionEnd:D,isSelected:B?.isSlotSelected(K)??!1,isSelecting:B?.isSelecting??!1,disabled:C,className:"absolute inset-x-0",style:{top:`${T*u}%`,height:`${u}%`},ariaLabel:`Add event at ${g.formatHourLabel(k)}:${String($).padStart(2,"0")}`},$)})]})]},k)}),e.jsx("div",{className:"absolute top-0 bottom-0 right-0 pointer-events-none",style:{left:De},children:_.map(k=>{const c=E.get(k.id);if(!c)return null;const h=`calc(${c.width}% - 2px)`,C=`max(${Ce}px, ${h})`;return l?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${c.top}px`,left:`${c.left}%`,width:C,minWidth:`${Ce}px`},children:l({event:k,position:c})},k.id):e.jsx(Le,{event:k,position:{top:c.top,left:c.left,width:c.width,minWidth:Ce},hourHeight:ce,badgeVariant:p,onClick:i,disablePopover:!!i&&!b,renderPopover:b,className:d.cn("pointer-events-auto",x?.eventCard)},k.id)})}),W&&S>=0&&e.jsxs("div",{className:d.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",x?.currentTimeIndicator),style:{top:S,left:De},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 Ut=[{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"}],Kt=[{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"}],ue=3;function Xt({events:t,date:n,weekStartsOn:s=1,badgeVariant:r="colored",onEventClick:o,onSlotSelect:p,onDayClick:i,className:y,renderEvent:v,renderPopover:l,showMoreMode:b,showMoreEventsInPopover:w=!1,slots:x,classNames:f}){const u=b??(w?"popover":"expand"),j=x?.dayCellHeader,N=x?.dayCellFooter,[_,M]=a.useState(null),[E,I]=a.useState(null),A=a.useMemo(()=>g.generateMonthGrid(n,s),[n,s]),W=a.useMemo(()=>{const m=new Map;for(const L of A){const H=L.date.toDateString(),P=g.getEventsForDay(t,L.date);P.sort((k,c)=>k.startDate.getTime()-c.startDate.getTime()),m.set(H,P)}return m},[A,t]),S=de.useOptionalSlotSelection(),R=a.useCallback(m=>{S?.startSelection(m)},[S]),B=a.useCallback(m=>{S?.updateSelection(m)},[S]),z=a.useCallback(()=>{S?.endSelection()},[S]),G=a.useCallback(m=>{i?.(m)},[i]),D=s===0?Kt:Ut;return e.jsxs("div",{className:d.cn("flex flex-col h-full overflow-hidden",y),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:d.cn("grid grid-cols-7 border-b !sticky !top-0 bg-background z-10",f?.weekdayHeader),children:D.map((m,L)=>e.jsxs("div",{className:d.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",f?.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:d.cn("grid grid-cols-7 auto-rows-min",f?.monthGrid),children:A.map(m=>{const L=m.date.toDateString(),H=W.get(L)||[],P=g.isToday(m.date),k=m.date.getDay()===0||m.date.getDay()===6,c=H.length>ue;return e.jsxs(tt,{date:m.date,dataAttributes:{"data-day-key":L},onSelectionStart:R,onSelectionMove:B,onSelectionEnd:z,isSelected:S?.isSlotSelected({date:m.date})??!1,isSelecting:S?.isSelecting??!1,className:d.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",k&&m.isCurrentMonth&&"bg-muted/10",f?.dayCell,P&&f?.dayCellToday,!m.isCurrentMonth&&f?.dayCellOutside,k&&f?.dayCellWeekend),ariaLabel:`${m.date.toLocaleDateString()} - ${H.length} events. Click to create event, double-click to view day.`,children:[e.jsx("div",{className:d.cn("flex items-center justify-center p-1",!m.isCurrentMonth&&"text-muted-foreground/40",f?.dayCellNumber),children:e.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),G(m.date)},className:d.cn("flex items-center justify-center rounded-full transition-colors","size-7 text-sm font-normal",P?"bg-primary text-primary-foreground":"hover:bg-muted"),children:m.date.getDate()})}),j&&e.jsx(j,{date:m.date,events:H,isToday:P,isCurrentMonth:m.isCurrentMonth,isWeekend:k,view:"month"}),e.jsxs("div",{className:d.cn("flex-1 overflow-hidden px-2 pt-1 pb-1 space-y-1",f?.dayCellContent),children:[H.slice(0,ue).map(h=>e.jsx("div",{onPointerDown:C=>{C.stopPropagation()},children:v?v({event:h,variant:"compact"}):e.jsx(he,{event:h,variant:"compact",badgeVariant:r,onClick:o,disablePopover:!!o&&!l,renderPopover:l,showTime:!1,enableDrag:!0,...f?.eventCardCompact&&{className:f.eventCardCompact}})},h.id)),c&&u==="expand"&&e.jsxs("button",{type:"button",onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation();const C=document.querySelector(`[data-day-key="${L}"]`);I({date:m.date,events:H,rect:C?.getBoundingClientRect()??new DOMRect(window.innerWidth/2-180,window.innerHeight/2-240,0,0)})},className:d.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",f?.moreEventsIndicator),children:["+",H.length-ue," more"]}),c&&u==="popover"&&e.jsxs(Z,{open:_===L,onOpenChange:h=>M(h?L:null),children:[e.jsx(Q,{asChild:!0,children:e.jsxs("button",{type:"button",onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation(),M(L)},className:d.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",f?.moreEventsIndicator),children:["+",H.length-ue," more"]})}),e.jsxs(X,{align:"start",side:"right",sideOffset:8,className:"w-72 max-h-80 overflow-y-auto p-2",onPointerDown:h=>h.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:[H.length," events"]})]}),e.jsx("div",{className:"space-y-1.5",children:H.map(h=>e.jsx("div",{children:v?v({event:h,variant:"compact"}):e.jsx(he,{event:h,variant:"compact",badgeVariant:r,onClick:C=>{M(null),o?.(C)},disablePopover:!!o&&!l,renderPopover:l,showTime:!0})},h.id))})]})]}),c&&u==="dayView"&&e.jsxs("div",{onPointerDown:h=>{h.stopPropagation(),G(m.date)},className:d.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",f?.moreEventsIndicator),children:["+",H.length-ue," more"]})]}),N&&e.jsx(N,{date:m.date,events:H,isToday:P,isCurrentMonth:m.isCurrentMonth,isWeekend:k,view:"month"})]},L)})})]})}),e.jsx(Ze,{isOpen:E!==null,onClose:()=>I(null),date:E?.date??new Date,events:E?.events??[],anchorRect:E?.rect??null,badgeVariant:r,onEventClick:o,renderEvent:v,renderPopover:l})]})}const ve=26,Oe=2,ye=4;function Pe(t,n){const s=g.startOfDay(t);for(let o=0;o<n.length;o++){const p=n[o];if(p&&g.isSameDay(s,p))return o}const r=n[0];return r&&s<g.startOfDay(r)?-1:7}function Yt(t){const n=[...t].sort((r,o)=>{const p=r.endCol-r.startCol,i=o.endCol-o.startCol;return i!==p?i-p:r.startCol-o.startCol}),s=[];return n.map(r=>{let o=-1;for(let i=0;i<s.length;i++){const y=s[i];if(!y)continue;let v=!0;for(let l=r.startCol;l<=r.endCol;l++)if(y[l]){v=!1;break}if(v){o=i;break}}o===-1&&(o=s.length,s.push(new Array(7).fill(!1)));const p=s[o];if(p)for(let i=r.startCol;i<=r.endCol;i++)p[i]=!0;return{...r,row:o}})}function Jt({pe:t,onEventClick:n,disablePopover:s,renderPopover:r}){const[o,p]=a.useState(!1),i=se(t.event.color),y=a.useCallback(()=>{s&&n?n(t.event):s||p(!0)},[s,n,t.event]),v=a.useCallback(()=>{p(!1)},[]),l=e.jsxs("button",{type:"button",onClick:y,className:d.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:ve,lineHeight:`${ve}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:"▸"})]}),b=e.jsx(J,{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:g.formatEventTimeDisplay(t.event)})]})}),w={gridColumn:`${t.startCol+2} / ${t.endCol+3}`,gridRow:t.row+1};return s?e.jsx("div",{style:w,children:e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:l}),b]})}):e.jsx("div",{style:w,children:e.jsxs(Z,{open:o,onOpenChange:p,children:[e.jsx(Q,{asChild:!0,children:l}),e.jsx(X,{className:"w-80",children:r?r({event:t.event,onClose:v}):e.jsx(Zt,{event:t.event,onClose:v})})]})})}function Zt({event:t,onClose:n}){const s=se(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:d.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:d.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:g.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 Qt({events:t,weekDays:n,hourColumnWidth:s,minDayColumnWidth:r,dayColumnWidths:o,onEventClick:p,disablePopover:i=!1,renderPopover:y,className:v}){const l=a.useMemo(()=>{if(t.length===0)return[];const N=t.map(_=>{const M=Pe(_.startDate,n),E=Pe(_.endDate,n),I=Math.max(0,M),A=Math.min(6,E);if(I>6||A<0)return null;const W=M<0,S=E>6,B=g.detectAllDayEvent(_)&&g.isSameDay(_.startDate,_.endDate);return{event:_,startCol:I,endCol:A,continuesBefore:W,continuesAfter:S,isSingleDayAllDay:B}}).filter(Boolean);return Yt(N)},[t,n]);if(l.length===0)return null;const b=Math.max(...l.map(N=>N.row))+1,w=Math.min(b,ye),x=b>ye,f=x?l.filter(N=>N.row>=ye).length:0,u=[`${s}px`,...o.map(N=>N>r?`${N}px`:`minmax(${r}px, 1fr)`)].join(" "),j=w*ve+(w-1)*Oe+8;return e.jsxs("div",{className:d.cn("ic-all-day-row border-b bg-muted/20 relative",v),style:{display:"grid",gridTemplateColumns:u,gridTemplateRows:`repeat(${w}, ${ve}px)`,gap:`${Oe}px 0`,paddingTop:4,paddingBottom:4,minHeight:j},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 ${w}`},children:e.jsx("span",{className:"hidden sm:inline",children:"All day"})}),n.map((N,_)=>e.jsx("div",{className:"pointer-events-none border-r last:border-r-0",style:{gridColumn:_+2,gridRow:`1 / span ${w}`}},N.toDateString())),l.filter(N=>N.row<ye).map(N=>e.jsx(Jt,{pe:N,onEventClick:p,disablePopover:i,renderPopover:y},N.event.id)),x&&e.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium px-2 flex items-center",style:{gridColumn:`2 / ${n.length+2}`,gridRow:w},children:["+",f," more"]})]})}const ae=96,xe=56,Ve=72,Y=120,be=100,en=3;function tn({events:t,date:n,weekStartsOn:s=1,visibleHours:r={startHour:0,endHour:24},workingHours:o,slotDuration:p=30,badgeVariant:i="colored",onEventClick:y,onSlotSelect:v,onDayClick:l,className:b,renderEvent:w,renderPopover:x,slots:f,classNames:u}){const j=60/p,N=100/j,_=a.useMemo(()=>{const c=[];for(let h=0;h<j;h++)c.push(h*p);return c},[j,p]),M=a.useMemo(()=>g.getWeekDays(n,s),[n,s]),E=a.useMemo(()=>g.getVisibleHoursArray(r),[r]),I=a.useMemo(()=>{const c=new Map;for(const h of M){const C=h.toDateString(),$=g.getEventsForDay(t,h),{singleDay:T,multiDay:K}=g.separateEventsByDuration($),O=g.calculateOverlappingPositions(T,h,r,ae),F=new Map;let q=1;for(const U of O)if(F.set(U.event.id,U.position),U.position.width>0){const re=Math.round(100/U.position.width);q=Math.max(q,re)}c.set(C,{singleDay:T,multiDay:K,positions:F,maxOverlapping:q})}return c},[M,t,r]),A=a.useMemo(()=>{const c=new Map;for(const{multiDay:h}of I.values())for(const C of h)c.set(C.id,C);return Array.from(c.values())},[I]),W=new Date,S=M.findIndex(c=>g.isToday(c)),R=a.useMemo(()=>{if(S<0)return-1;const c=W.getHours()+W.getMinutes()/60;return c<r.startHour||c>r.endHour?-1:(c-r.startHour)*ae},[S,r,W]),B=a.useRef(null);a.useLayoutEffect(()=>{const c=B.current;if(!c)return;const h=()=>{let C;if(S!==-1){const T=new Date().getHours();C=Math.max(T-1,r.startHour)}else{const K=new Date().getDay();let O=o?.[K];if(!O?.enabled||O.from===0){const F=o?.[1];F?.enabled&&(O=F)}O?.enabled&&O.from>0?C=Math.max(O.from-1,r.startHour):C=Math.max(7,r.startHour)}const $=(C-r.startHour)*ae;c.scrollTo({top:$,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(h)})},[n,o,r,S]);const z=de.useOptionalSlotSelection(),G=a.useCallback(c=>{z?.startSelection(c)},[z]),D=a.useCallback(c=>{z?.updateSelection(c)},[z]),m=a.useCallback(()=>{z?.endSelection()},[z]),L=a.useCallback(c=>{y?.(c)},[y]),H=xe+7*Y,P=a.useMemo(()=>{const c=[];for(const h of M){const C=h.toDateString(),T=I.get(C)?.maxOverlapping??1;T>en?c.push(Math.max(Y,T*be)):c.push(Y)}return c},[M,I]),k=xe+P.reduce((c,h)=>c+h,0);return e.jsxs("div",{className:d.cn("ic-week-view flex flex-col h-full",b),children:[A.length>0&&e.jsx(Qt,{events:A,weekDays:M,hourColumnWidth:xe,minDayColumnWidth:Y,dayColumnWidths:P,onEventClick:L,disablePopover:!!y&&!x,renderPopover:x,...u?.multiDayBanner&&{className:u.multiDayBanner}}),e.jsx("div",{ref:B,className:d.cn("ic-week-scroll-container flex-1",u?.scrollContainer),children:e.jsxs("div",{style:{minWidth:Math.max(H,k)},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:xe,height:Ve},children:e.jsxs("span",{className:"hidden sm:inline",children:["GMT",(()=>{const c=new Date().getTimezoneOffset(),h=Math.abs(Math.floor(c/60)),C=c<=0?"+":"-";return h>0?`${C}${String(h).padStart(2,"0")}`:""})()]})}),M.map((c,h)=>{const C=g.isToday(c),$=P[h]??Y,T=$>Y;return e.jsxs("div",{className:d.cn("flex-1 flex flex-col items-center justify-center border-r last:border-r-0 py-2",u?.columnHeader,C&&u?.columnHeaderToday),style:{height:Ve,minWidth:T?$:Y},children:[e.jsx("span",{className:d.cn("text-[11px] font-medium uppercase tracking-wide",C?"text-primary":"text-muted-foreground"),children:c.toLocaleDateString([],{weekday:"short"})}),e.jsx("button",{type:"button",onClick:()=>l?.(c),className:d.cn("flex items-center justify-center rounded-full transition-colors mt-0.5","size-10 text-2xl font-normal",C?"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:d.cn("ic-hour-column sticky left-0 z-10 bg-zinc-50 border-r",u?.timeGutter),style:{width:xe},children:E.map((c,h)=>e.jsx("div",{className:"relative",style:{height:ae},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:h!==0&&e.jsx("span",{className:d.cn("text-[10px] sm:text-xs text-muted-foreground",u?.timeGutterLabel),children:g.formatHourLabel(c)})})},c))}),e.jsx("div",{className:"ic-week-grid relative flex-1",children:e.jsx("div",{className:"flex divide-x",children:M.map((c,h)=>{const C=c.toDateString(),$=I.get(C),T=P[h]??Y,K=T>Y;return e.jsxs("div",{className:"ic-day-column relative flex-1",style:{minWidth:K?T:Y},children:[E.map((O,F)=>{const U=!g.isWorkingHour(c,O,o);return e.jsxs("div",{className:d.cn("relative",U&&"bg-calendar-disabled-hour",g.isToday(c)&&!U&&"bg-primary/5",u?.timeSlot,U?u?.timeSlotNonWorking:u?.timeSlotWorking),style:{height:ae},children:[F!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),_.slice(1).map(re=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${re/60*100}%`}},re)),_.map((re,nt)=>{const _e={date:c,hour:O,minute:re};return e.jsx(We,{slot:_e,onSelectionStart:G,onSelectionMove:D,onSelectionEnd:m,isSelected:z?.isSlotSelected(_e)??!1,isSelecting:z?.isSelecting??!1,disabled:U,className:"absolute inset-x-0",style:{top:`${nt*N}%`,height:`${N}%`},ariaLabel:`Add event on ${c.toLocaleDateString()} at ${g.formatHourLabel(O)}:${String(re).padStart(2,"0")}`},re)})]},O)}),$?.singleDay.map(O=>{const F=$.positions.get(O.id);if(!F)return null;const q=`calc(${F.width}% - 2px)`,U=`max(${be}px, ${q})`;return w?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${F.top}px`,left:`${F.left}%`,width:U,minWidth:`${be}px`},children:w({event:O,position:F})},O.id):e.jsx(Le,{event:O,position:{top:F.top,left:F.left,width:F.width,minWidth:be},hourHeight:ae,badgeVariant:i,onClick:y,disablePopover:!!y&&!x,renderPopover:x,className:d.cn("pointer-events-auto",u?.eventCard)},O.id)}),h===S&&R>=0&&e.jsxs("div",{className:d.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",u?.currentTimeIndicator),style:{top:R},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=Pt;exports.Badge=Xe;exports.Button=oe;exports.CalendarHeader=Ot;exports.DateNavigator=Ye;exports.DayEventsExpansion=Ze;exports.DaySlot=tt;exports.DayView=Gt;exports.DropdownMenu=Me;exports.DropdownMenuContent=je;exports.DropdownMenuItem=we;exports.DropdownMenuTrigger=Te;exports.EventBlock=Le;exports.EventCard=he;exports.MonthView=Xt;exports.MultiDayBanner=Qe;exports.MultiDayEventBar=ct;exports.Popover=Z;exports.PopoverAnchor=at;exports.PopoverContent=X;exports.PopoverTrigger=Q;exports.TimeSlot=We;exports.TodayButton=Je;exports.Tooltip=te;exports.TooltipContent=J;exports.TooltipProvider=it;exports.TooltipTrigger=ne;exports.WeekView=tn;exports.buttonVariants=Ue;exports.getEventColorClasses=se;
|
|
11
|
-
//# sourceMappingURL=week-view-7r6Vhahg.cjs.map
|