@libxai/board 1.5.93 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _libxai_core from '@libxai/core';
2
2
  import { Dependency, BaseViewAdapter, ViewBoardData, ExportFormat as ExportFormat$1, ViewOptions, BoardData, ColumnData, CardData, BoardState, BoardStore, Board as Board$1, Column as Column$2, Card as Card$2, Priority as Priority$1, CardStatus as CardStatus$1, DragState, SelectionState } from '@libxai/core';
3
- export { AutoScheduleOptions, BaseEntity, Baseline, BaselineCardSnapshot, BoardData, Board as BoardModel, BoardState, BoardStore, CardData, Card as CardModel, ColumnData, Column as ColumnModel, CriticalPath, Dependency, DependencyEngine, DependencyType, DependencyValidation, GanttConfig, GanttState, Milestone, ResourceAllocation, ResourceUtilization, ScheduledTask, Store, StoreEvent, TaskConstraint, TaskConstraintType, UserData } from '@libxai/core';
3
+ export { AutoScheduleOptions, BaseEntity, Baseline, BaselineCardSnapshot, BoardData, Board as BoardModel, BoardState, BoardStore, CardData, Card as CardModel, ColumnData, Column as ColumnModel, CriticalPath, Dependency, DependencyEngine, DependencyType, DependencyValidation, GanttConfig as GanttCoreConfig, GanttState, Milestone, ResourceAllocation, ResourceUtilization, ScheduledTask, Store, StoreEvent, TaskConstraint, TaskConstraintType, UserData } from '@libxai/core';
4
4
  import * as React$1 from 'react';
5
5
  import React__default, { ReactNode, Component, ErrorInfo } from 'react';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -384,6 +384,16 @@ interface GanttConfig {
384
384
  rowDensity?: RowDensity;
385
385
  showThemeSelector?: boolean;
386
386
  showExportButton?: boolean;
387
+ /**
388
+ * Override the default Excel export with a consumer-supplied handler.
389
+ * When set, clicking "Export to Excel" in the share/export dropdown
390
+ * runs this function instead of the library's built-in ganttUtils
391
+ * exporter. The handler is responsible for the entire export (including
392
+ * triggering the file download). Useful for plugging in a custom
393
+ * template or branded format. `onExportSuccess` still fires after a
394
+ * successful run.
395
+ */
396
+ onExportExcel?: () => Promise<void>;
387
397
  /**
388
398
  * v2.8.0: Fired AFTER a successful export so the consuming app can record
389
399
  * the event in its audit log / analytics. Receives the report type that
@@ -6810,4 +6820,4 @@ declare const themes: Record<ThemeName, Theme>;
6810
6820
  */
6811
6821
  declare const defaultTheme: ThemeName;
6812
6822
 
6813
- export { type AICallbacks, type AICommandResult, type GanttTask as AIGanttTask, type AIMessage, type AIModelKey, type AIOperation, AIUsageDashboard, type AIUsageDashboardProps, AI_FEATURES, AI_MODELS, type Activity, type ActivityType, AddCardButton, type AddCardButtonProps, type AddCardData, AddColumnButton, type AddColumnButtonProps, type AssigneeSuggestion, type Attachment, AttachmentUploader, type AttachmentUploaderProps, type AvailableUser, type Board, type BoardCallbacks, type BoardConfig, BoardProvider, type BoardProviderProps, type BorderRadiusToken, BulkOperationsToolbar, type BulkOperationsToolbarProps, BurnDownChart, type BurnDownChartProps, type BurnDownDataPoint, CUSTOM_FIELD_TYPES, CalendarBoard, type CalendarBoardProps, type CalendarCallbacks, type CalendarConfig, type CalendarDay, type CalendarEvent, type CalendarPermissions, type CalendarSupportedLocale, type CalendarTheme, type CalendarThemeName, type CalendarTranslations, type CalendarViewMode, Card, CardDetailModal, type CardDetailModalProps, CardDetailModalV2, type CardDetailModalV2Props, type CardFilter, type CardFilters, CardHistoryReplay, type CardHistoryReplayProps, CardHistoryTimeline, type CardHistoryTimelineProps, type CardProps, CardRelationshipsGraph, type CardRelationshipsGraphProps, type CardSort, type CardSortKey, CardStack, type CardStackProps, type CardStack$1 as CardStackType, type CardStatus, type CardTemplate, CardTemplateSelector, type CardTemplateSelectorProps, type CardTimeProps, type Card$1 as CardType, CircuitBreaker, Column, ColumnManager, type ColumnProps, type Column$1 as ColumnType, CommandPalette, type CommandPaletteProps, type Comment, type CommentAttachment, ConfigMenu, type ConfigMenuProps, ContextMenu, type ContextMenuAction, type ContextMenuState, type CustomFieldDefinition, type CustomFieldValue, DEFAULT_SHORTCUTS, DEFAULT_TABLE_COLUMNS, DEFAULT_TEMPLATES, type DateFilter, DateRangePicker, type DateRangePickerProps, DependenciesSelector, type DependenciesSelectorProps, DependencyLine, type DesignTokens, DistributionCharts, type DistributionChartsProps, type DistributionDataPoint, type DragData, type DropData, type DurationToken, type EasingToken, EditableColumnTitle, type EditableColumnTitleProps, ErrorBoundary, type ErrorBoundaryProps, ExportDropdown, type ExportFormat, ExportImportModal, type ExportImportModalProps, type ExportOptions, FilterBar, type FilterBarProps, type FilterState, type FlattenedTask, type FontSizeToken, type FontWeightToken, GANTT_AI_SYSTEM_PROMPT, GanttAIAssistant, type GanttAIAssistantConfig, type Assignee as GanttAssignee, GanttBoard, type GanttConfig as GanttBoardConfig, type GanttBoardRef, type GanttColumn, type ColumnType$1 as GanttColumnType, GanttI18nContext, Milestone as GanttMilestone, type GanttPermissions, type Task as GanttTask, type GanttTemplates, type Theme$1 as GanttTheme, type GanttTheme as GanttThemeConfig, GanttToolbar, type GanttTranslations, GenerateGanttTasksDialog, type GenerateGanttTasksDialogProps, GeneratePlanModal, type GeneratePlanModalProps, type GeneratedPlan, type GeneratedTasksResponse, type GroupByOption, GroupBySelector, type GroupBySelectorProps, HealthBar, type HealthBarProps, type IPluginManager, type ImportResult, type Insight, type InsightSeverity, type InsightType, KanbanBoard, type KanbanBoardProps, KanbanToolbar, type KanbanToolbarProps, KanbanViewAdapter, type KanbanViewConfig, type KeyboardAction, type KeyboardShortcut, KeyboardShortcutsHelp, type KeyboardShortcutsHelpProps, type LineHeightToken, type ListColumn, type ColumnType as ListColumnType, type ListFilter, type ListSort, type ListSortColumn, ListView, type ListViewCallbacks, type ListViewConfig, type ListViewPermissions, type ListViewProps, type ListViewSupportedLocale, type ListViewTheme, type ListViewThemeName, type ListViewTranslations, MenuIcons, type OpacityToken, type PendingFile, type PersistHistoryConfig, type Plugin, type PluginContext, type PluginHooks, PluginManager, type Priority, PrioritySelector, type PrioritySelectorProps, ProfitabilityReport, type ProfitabilityReportProps, type ProjectForecast, type ProjectHealthData, QuickTaskCreate, type QuickTaskCreateData, type QuickTaskCreateProps, RATE_LIMITS, type RenderProps, type RetryOptions, type RetryResult, STANDARD_FIELDS, type ShadowToken, type SortBy, type SortDirection, type SortOrder, type SortState, type SpacingToken, type StackSuggestion, type StackingConfig, type StackingStrategy, type Subtask, type SupportedLocale, type Swimlane, SwimlaneBoardView, type SwimlaneBoardViewProps, type SwimlaneConfig, type TableColumn, TagBadge, TagList, TagPicker, TaskBar, type TaskComment, TaskDetailModal, type TaskDetailModalProps, type TaskFilterType, type TaskFormData, TaskFormModal, type TaskFormModalProps, TaskGrid, type TaskPriority, type TaskTag, type Theme, type ThemeColors, type ThemeContextValue, ThemeModal, type ThemeModalProps, type ThemeName, ThemeProvider, ThemeSwitcher, type TimeEntry, TimeInputPopover, type TimeInputPopoverProps, type TimeLogInput, type TimeLogSource, TimePill, type TimePillProps, TimePopover, type TimePopoverProps, type TimeScale, type TimeTrackingBoardProps, type TimeTrackingCallbacks, type TimeTrackingSummary, Timeline, type TimerState, type ThemeColors$1 as TokenThemeColors, type TokenValue, type UsageStats, type UseAIOptions, type UseAIReturn, type UseBoardReturn as UseBoardCoreReturn, type UseBoardOptions, type UseBoardReturn$1 as UseBoardReturn, type UseCardStackingOptions, type UseCardStackingResult, type UseDragStateReturn, type UseFiltersOptions, type UseFiltersReturn, type UseKanbanStateOptions, type UseKanbanStateReturn, type UseKeyboardShortcutsOptions, type UseKeyboardShortcutsReturn, type UseMultiSelectReturn, type UseSelectionStateReturn, type User$1 as User, UserAssignmentSelector, type UserAssignmentSelectorProps, VelocityChart, type VelocityChartProps, type VelocityDataPoint, VirtualGrid, type VirtualGridProps, VirtualList, type VirtualListProps, type WeekDay, type ZIndexToken, aiUsageTracker, borderRadius, calculatePosition, darkTheme$2 as calendarDarkTheme, en as calendarEnTranslations, es as calendarEsTranslations, lightTheme$2 as calendarLightTheme, neutralTheme$2 as calendarNeutralTheme, calendarThemes, calendarTranslations, cardToGanttTask, cardsToGanttTasks, cn, createKanbanView, createRetryWrapper, darkTheme, darkTheme$1 as darkTokenTheme, defaultTheme, designTokens, duration, easing, exportTokensToCSS, findTaskByName, fontSize, fontWeight, formatCost, en$2 as ganttEnTranslations, es$2 as ganttEsTranslations, ganttTaskToCardUpdate, themes$1 as ganttThemes, gantt as ganttTokens, translations as ganttTranslations, ganttUtils, generateCSSVariables, generateCompleteCSS, generateInitialPositions, generateTasksContext, generateThemeVariables, getCalendarTheme, getCalendarTranslations, getListViewTheme, getListViewTranslations, getMonthNames, getToken, getTranslations, getWeekdayNames, kanban as kanbanTokens, lightTheme, lightTheme$1 as lightTokenTheme, lineHeight, darkTheme$3 as listViewDarkTheme, en$1 as listViewEnTranslations, es$1 as listViewEsTranslations, lightTheme$3 as listViewLightTheme, neutralTheme$3 as listViewNeutralTheme, listViewThemes, listViewTranslations, mergeCalendarTranslations, mergeListViewTranslations, mergeTranslations, neutralTheme, neutralTheme$1 as neutralTokenTheme, opacity, parseLocalCommand, parseNaturalDate, parseNaturalDuration, parseProgress, parseStatus, pluginManager, retrySyncOperation, retryWithBackoff, shadows, shouldVirtualizeGrid, spacing, themes, useAI, useBoard$1 as useBoard, useBoard as useBoardCore, useBoardStore, useCardStacking, useDragState, useFilteredCards, useFilters, useGanttI18n, useKanbanState, useKeyboardShortcuts, useMultiSelect, useSelectionState, useSortedCards, useTheme, useVirtualGrid, useVirtualList, validateAIResponse, withErrorBoundary, wouldCreateCircularDependency, zIndex };
6823
+ export { type AICallbacks, type AICommandResult, type GanttTask as AIGanttTask, type AIMessage, type AIModelKey, type AIOperation, AIUsageDashboard, type AIUsageDashboardProps, AI_FEATURES, AI_MODELS, type Activity, type ActivityType, AddCardButton, type AddCardButtonProps, type AddCardData, AddColumnButton, type AddColumnButtonProps, type AssigneeSuggestion, type Attachment, AttachmentUploader, type AttachmentUploaderProps, type AvailableUser, type Board, type BoardCallbacks, type BoardConfig, BoardProvider, type BoardProviderProps, type BorderRadiusToken, BulkOperationsToolbar, type BulkOperationsToolbarProps, BurnDownChart, type BurnDownChartProps, type BurnDownDataPoint, CUSTOM_FIELD_TYPES, CalendarBoard, type CalendarBoardProps, type CalendarCallbacks, type CalendarConfig, type CalendarDay, type CalendarEvent, type CalendarPermissions, type CalendarSupportedLocale, type CalendarTheme, type CalendarThemeName, type CalendarTranslations, type CalendarViewMode, Card, CardDetailModal, type CardDetailModalProps, CardDetailModalV2, type CardDetailModalV2Props, type CardFilter, type CardFilters, CardHistoryReplay, type CardHistoryReplayProps, CardHistoryTimeline, type CardHistoryTimelineProps, type CardProps, CardRelationshipsGraph, type CardRelationshipsGraphProps, type CardSort, type CardSortKey, CardStack, type CardStackProps, type CardStack$1 as CardStackType, type CardStatus, type CardTemplate, CardTemplateSelector, type CardTemplateSelectorProps, type CardTimeProps, type Card$1 as CardType, CircuitBreaker, Column, ColumnManager, type ColumnProps, type Column$1 as ColumnType, CommandPalette, type CommandPaletteProps, type Comment, type CommentAttachment, ConfigMenu, type ConfigMenuProps, ContextMenu, type ContextMenuAction, type ContextMenuState, type CustomFieldDefinition, type CustomFieldValue, DEFAULT_SHORTCUTS, DEFAULT_TABLE_COLUMNS, DEFAULT_TEMPLATES, type DateFilter, DateRangePicker, type DateRangePickerProps, DependenciesSelector, type DependenciesSelectorProps, DependencyLine, type DesignTokens, DistributionCharts, type DistributionChartsProps, type DistributionDataPoint, type DragData, type DropData, type DurationToken, type EasingToken, EditableColumnTitle, type EditableColumnTitleProps, ErrorBoundary, type ErrorBoundaryProps, ExportDropdown, type ExportFormat, ExportImportModal, type ExportImportModalProps, type ExportOptions, FilterBar, type FilterBarProps, type FilterState, type FlattenedTask, type FontSizeToken, type FontWeightToken, GANTT_AI_SYSTEM_PROMPT, GanttAIAssistant, type GanttAIAssistantConfig, type Assignee as GanttAssignee, GanttBoard, type GanttConfig as GanttBoardConfig, type GanttBoardRef, type GanttColumn, type ColumnType$1 as GanttColumnType, type GanttConfig, GanttI18nContext, Milestone as GanttMilestone, type GanttPermissions, type Task as GanttTask, type GanttTemplates, type Theme$1 as GanttTheme, type GanttTheme as GanttThemeConfig, GanttToolbar, type GanttTranslations, GenerateGanttTasksDialog, type GenerateGanttTasksDialogProps, GeneratePlanModal, type GeneratePlanModalProps, type GeneratedPlan, type GeneratedTasksResponse, type GroupByOption, GroupBySelector, type GroupBySelectorProps, HealthBar, type HealthBarProps, type IPluginManager, type ImportResult, type Insight, type InsightSeverity, type InsightType, KanbanBoard, type KanbanBoardProps, KanbanToolbar, type KanbanToolbarProps, KanbanViewAdapter, type KanbanViewConfig, type KeyboardAction, type KeyboardShortcut, KeyboardShortcutsHelp, type KeyboardShortcutsHelpProps, type LineHeightToken, type ListColumn, type ColumnType as ListColumnType, type ListFilter, type ListSort, type ListSortColumn, ListView, type ListViewCallbacks, type ListViewConfig, type ListViewPermissions, type ListViewProps, type ListViewSupportedLocale, type ListViewTheme, type ListViewThemeName, type ListViewTranslations, MenuIcons, type OpacityToken, type PendingFile, type PersistHistoryConfig, type Plugin, type PluginContext, type PluginHooks, PluginManager, type Priority, PrioritySelector, type PrioritySelectorProps, ProfitabilityReport, type ProfitabilityReportProps, type ProjectForecast, type ProjectHealthData, QuickTaskCreate, type QuickTaskCreateData, type QuickTaskCreateProps, RATE_LIMITS, type RenderProps, type RetryOptions, type RetryResult, STANDARD_FIELDS, type ShadowToken, type SortBy, type SortDirection, type SortOrder, type SortState, type SpacingToken, type StackSuggestion, type StackingConfig, type StackingStrategy, type Subtask, type SupportedLocale, type Swimlane, SwimlaneBoardView, type SwimlaneBoardViewProps, type SwimlaneConfig, type TableColumn, TagBadge, TagList, TagPicker, TaskBar, type TaskComment, TaskDetailModal, type TaskDetailModalProps, type TaskFilterType, type TaskFormData, TaskFormModal, type TaskFormModalProps, TaskGrid, type TaskPriority, type TaskTag, type Theme, type ThemeColors, type ThemeContextValue, ThemeModal, type ThemeModalProps, type ThemeName, ThemeProvider, ThemeSwitcher, type TimeEntry, TimeInputPopover, type TimeInputPopoverProps, type TimeLogInput, type TimeLogSource, TimePill, type TimePillProps, TimePopover, type TimePopoverProps, type TimeScale, type TimeTrackingBoardProps, type TimeTrackingCallbacks, type TimeTrackingSummary, Timeline, type TimerState, type ThemeColors$1 as TokenThemeColors, type TokenValue, type UsageStats, type UseAIOptions, type UseAIReturn, type UseBoardReturn as UseBoardCoreReturn, type UseBoardOptions, type UseBoardReturn$1 as UseBoardReturn, type UseCardStackingOptions, type UseCardStackingResult, type UseDragStateReturn, type UseFiltersOptions, type UseFiltersReturn, type UseKanbanStateOptions, type UseKanbanStateReturn, type UseKeyboardShortcutsOptions, type UseKeyboardShortcutsReturn, type UseMultiSelectReturn, type UseSelectionStateReturn, type User$1 as User, UserAssignmentSelector, type UserAssignmentSelectorProps, VelocityChart, type VelocityChartProps, type VelocityDataPoint, VirtualGrid, type VirtualGridProps, VirtualList, type VirtualListProps, type WeekDay, type ZIndexToken, aiUsageTracker, borderRadius, calculatePosition, darkTheme$2 as calendarDarkTheme, en as calendarEnTranslations, es as calendarEsTranslations, lightTheme$2 as calendarLightTheme, neutralTheme$2 as calendarNeutralTheme, calendarThemes, calendarTranslations, cardToGanttTask, cardsToGanttTasks, cn, createKanbanView, createRetryWrapper, darkTheme, darkTheme$1 as darkTokenTheme, defaultTheme, designTokens, duration, easing, exportTokensToCSS, findTaskByName, fontSize, fontWeight, formatCost, en$2 as ganttEnTranslations, es$2 as ganttEsTranslations, ganttTaskToCardUpdate, themes$1 as ganttThemes, gantt as ganttTokens, translations as ganttTranslations, ganttUtils, generateCSSVariables, generateCompleteCSS, generateInitialPositions, generateTasksContext, generateThemeVariables, getCalendarTheme, getCalendarTranslations, getListViewTheme, getListViewTranslations, getMonthNames, getToken, getTranslations, getWeekdayNames, kanban as kanbanTokens, lightTheme, lightTheme$1 as lightTokenTheme, lineHeight, darkTheme$3 as listViewDarkTheme, en$1 as listViewEnTranslations, es$1 as listViewEsTranslations, lightTheme$3 as listViewLightTheme, neutralTheme$3 as listViewNeutralTheme, listViewThemes, listViewTranslations, mergeCalendarTranslations, mergeListViewTranslations, mergeTranslations, neutralTheme, neutralTheme$1 as neutralTokenTheme, opacity, parseLocalCommand, parseNaturalDate, parseNaturalDuration, parseProgress, parseStatus, pluginManager, retrySyncOperation, retryWithBackoff, shadows, shouldVirtualizeGrid, spacing, themes, useAI, useBoard$1 as useBoard, useBoard as useBoardCore, useBoardStore, useCardStacking, useDragState, useFilteredCards, useFilters, useGanttI18n, useKanbanState, useKeyboardShortcuts, useMultiSelect, useSelectionState, useSortedCards, useTheme, useVirtualGrid, useVirtualList, validateAIResponse, withErrorBoundary, wouldCreateCircularDependency, zIndex };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _libxai_core from '@libxai/core';
2
2
  import { Dependency, BaseViewAdapter, ViewBoardData, ExportFormat as ExportFormat$1, ViewOptions, BoardData, ColumnData, CardData, BoardState, BoardStore, Board as Board$1, Column as Column$2, Card as Card$2, Priority as Priority$1, CardStatus as CardStatus$1, DragState, SelectionState } from '@libxai/core';
3
- export { AutoScheduleOptions, BaseEntity, Baseline, BaselineCardSnapshot, BoardData, Board as BoardModel, BoardState, BoardStore, CardData, Card as CardModel, ColumnData, Column as ColumnModel, CriticalPath, Dependency, DependencyEngine, DependencyType, DependencyValidation, GanttConfig, GanttState, Milestone, ResourceAllocation, ResourceUtilization, ScheduledTask, Store, StoreEvent, TaskConstraint, TaskConstraintType, UserData } from '@libxai/core';
3
+ export { AutoScheduleOptions, BaseEntity, Baseline, BaselineCardSnapshot, BoardData, Board as BoardModel, BoardState, BoardStore, CardData, Card as CardModel, ColumnData, Column as ColumnModel, CriticalPath, Dependency, DependencyEngine, DependencyType, DependencyValidation, GanttConfig as GanttCoreConfig, GanttState, Milestone, ResourceAllocation, ResourceUtilization, ScheduledTask, Store, StoreEvent, TaskConstraint, TaskConstraintType, UserData } from '@libxai/core';
4
4
  import * as React$1 from 'react';
5
5
  import React__default, { ReactNode, Component, ErrorInfo } from 'react';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -384,6 +384,16 @@ interface GanttConfig {
384
384
  rowDensity?: RowDensity;
385
385
  showThemeSelector?: boolean;
386
386
  showExportButton?: boolean;
387
+ /**
388
+ * Override the default Excel export with a consumer-supplied handler.
389
+ * When set, clicking "Export to Excel" in the share/export dropdown
390
+ * runs this function instead of the library's built-in ganttUtils
391
+ * exporter. The handler is responsible for the entire export (including
392
+ * triggering the file download). Useful for plugging in a custom
393
+ * template or branded format. `onExportSuccess` still fires after a
394
+ * successful run.
395
+ */
396
+ onExportExcel?: () => Promise<void>;
387
397
  /**
388
398
  * v2.8.0: Fired AFTER a successful export so the consuming app can record
389
399
  * the event in its audit log / analytics. Receives the report type that
@@ -6810,4 +6820,4 @@ declare const themes: Record<ThemeName, Theme>;
6810
6820
  */
6811
6821
  declare const defaultTheme: ThemeName;
6812
6822
 
6813
- export { type AICallbacks, type AICommandResult, type GanttTask as AIGanttTask, type AIMessage, type AIModelKey, type AIOperation, AIUsageDashboard, type AIUsageDashboardProps, AI_FEATURES, AI_MODELS, type Activity, type ActivityType, AddCardButton, type AddCardButtonProps, type AddCardData, AddColumnButton, type AddColumnButtonProps, type AssigneeSuggestion, type Attachment, AttachmentUploader, type AttachmentUploaderProps, type AvailableUser, type Board, type BoardCallbacks, type BoardConfig, BoardProvider, type BoardProviderProps, type BorderRadiusToken, BulkOperationsToolbar, type BulkOperationsToolbarProps, BurnDownChart, type BurnDownChartProps, type BurnDownDataPoint, CUSTOM_FIELD_TYPES, CalendarBoard, type CalendarBoardProps, type CalendarCallbacks, type CalendarConfig, type CalendarDay, type CalendarEvent, type CalendarPermissions, type CalendarSupportedLocale, type CalendarTheme, type CalendarThemeName, type CalendarTranslations, type CalendarViewMode, Card, CardDetailModal, type CardDetailModalProps, CardDetailModalV2, type CardDetailModalV2Props, type CardFilter, type CardFilters, CardHistoryReplay, type CardHistoryReplayProps, CardHistoryTimeline, type CardHistoryTimelineProps, type CardProps, CardRelationshipsGraph, type CardRelationshipsGraphProps, type CardSort, type CardSortKey, CardStack, type CardStackProps, type CardStack$1 as CardStackType, type CardStatus, type CardTemplate, CardTemplateSelector, type CardTemplateSelectorProps, type CardTimeProps, type Card$1 as CardType, CircuitBreaker, Column, ColumnManager, type ColumnProps, type Column$1 as ColumnType, CommandPalette, type CommandPaletteProps, type Comment, type CommentAttachment, ConfigMenu, type ConfigMenuProps, ContextMenu, type ContextMenuAction, type ContextMenuState, type CustomFieldDefinition, type CustomFieldValue, DEFAULT_SHORTCUTS, DEFAULT_TABLE_COLUMNS, DEFAULT_TEMPLATES, type DateFilter, DateRangePicker, type DateRangePickerProps, DependenciesSelector, type DependenciesSelectorProps, DependencyLine, type DesignTokens, DistributionCharts, type DistributionChartsProps, type DistributionDataPoint, type DragData, type DropData, type DurationToken, type EasingToken, EditableColumnTitle, type EditableColumnTitleProps, ErrorBoundary, type ErrorBoundaryProps, ExportDropdown, type ExportFormat, ExportImportModal, type ExportImportModalProps, type ExportOptions, FilterBar, type FilterBarProps, type FilterState, type FlattenedTask, type FontSizeToken, type FontWeightToken, GANTT_AI_SYSTEM_PROMPT, GanttAIAssistant, type GanttAIAssistantConfig, type Assignee as GanttAssignee, GanttBoard, type GanttConfig as GanttBoardConfig, type GanttBoardRef, type GanttColumn, type ColumnType$1 as GanttColumnType, GanttI18nContext, Milestone as GanttMilestone, type GanttPermissions, type Task as GanttTask, type GanttTemplates, type Theme$1 as GanttTheme, type GanttTheme as GanttThemeConfig, GanttToolbar, type GanttTranslations, GenerateGanttTasksDialog, type GenerateGanttTasksDialogProps, GeneratePlanModal, type GeneratePlanModalProps, type GeneratedPlan, type GeneratedTasksResponse, type GroupByOption, GroupBySelector, type GroupBySelectorProps, HealthBar, type HealthBarProps, type IPluginManager, type ImportResult, type Insight, type InsightSeverity, type InsightType, KanbanBoard, type KanbanBoardProps, KanbanToolbar, type KanbanToolbarProps, KanbanViewAdapter, type KanbanViewConfig, type KeyboardAction, type KeyboardShortcut, KeyboardShortcutsHelp, type KeyboardShortcutsHelpProps, type LineHeightToken, type ListColumn, type ColumnType as ListColumnType, type ListFilter, type ListSort, type ListSortColumn, ListView, type ListViewCallbacks, type ListViewConfig, type ListViewPermissions, type ListViewProps, type ListViewSupportedLocale, type ListViewTheme, type ListViewThemeName, type ListViewTranslations, MenuIcons, type OpacityToken, type PendingFile, type PersistHistoryConfig, type Plugin, type PluginContext, type PluginHooks, PluginManager, type Priority, PrioritySelector, type PrioritySelectorProps, ProfitabilityReport, type ProfitabilityReportProps, type ProjectForecast, type ProjectHealthData, QuickTaskCreate, type QuickTaskCreateData, type QuickTaskCreateProps, RATE_LIMITS, type RenderProps, type RetryOptions, type RetryResult, STANDARD_FIELDS, type ShadowToken, type SortBy, type SortDirection, type SortOrder, type SortState, type SpacingToken, type StackSuggestion, type StackingConfig, type StackingStrategy, type Subtask, type SupportedLocale, type Swimlane, SwimlaneBoardView, type SwimlaneBoardViewProps, type SwimlaneConfig, type TableColumn, TagBadge, TagList, TagPicker, TaskBar, type TaskComment, TaskDetailModal, type TaskDetailModalProps, type TaskFilterType, type TaskFormData, TaskFormModal, type TaskFormModalProps, TaskGrid, type TaskPriority, type TaskTag, type Theme, type ThemeColors, type ThemeContextValue, ThemeModal, type ThemeModalProps, type ThemeName, ThemeProvider, ThemeSwitcher, type TimeEntry, TimeInputPopover, type TimeInputPopoverProps, type TimeLogInput, type TimeLogSource, TimePill, type TimePillProps, TimePopover, type TimePopoverProps, type TimeScale, type TimeTrackingBoardProps, type TimeTrackingCallbacks, type TimeTrackingSummary, Timeline, type TimerState, type ThemeColors$1 as TokenThemeColors, type TokenValue, type UsageStats, type UseAIOptions, type UseAIReturn, type UseBoardReturn as UseBoardCoreReturn, type UseBoardOptions, type UseBoardReturn$1 as UseBoardReturn, type UseCardStackingOptions, type UseCardStackingResult, type UseDragStateReturn, type UseFiltersOptions, type UseFiltersReturn, type UseKanbanStateOptions, type UseKanbanStateReturn, type UseKeyboardShortcutsOptions, type UseKeyboardShortcutsReturn, type UseMultiSelectReturn, type UseSelectionStateReturn, type User$1 as User, UserAssignmentSelector, type UserAssignmentSelectorProps, VelocityChart, type VelocityChartProps, type VelocityDataPoint, VirtualGrid, type VirtualGridProps, VirtualList, type VirtualListProps, type WeekDay, type ZIndexToken, aiUsageTracker, borderRadius, calculatePosition, darkTheme$2 as calendarDarkTheme, en as calendarEnTranslations, es as calendarEsTranslations, lightTheme$2 as calendarLightTheme, neutralTheme$2 as calendarNeutralTheme, calendarThemes, calendarTranslations, cardToGanttTask, cardsToGanttTasks, cn, createKanbanView, createRetryWrapper, darkTheme, darkTheme$1 as darkTokenTheme, defaultTheme, designTokens, duration, easing, exportTokensToCSS, findTaskByName, fontSize, fontWeight, formatCost, en$2 as ganttEnTranslations, es$2 as ganttEsTranslations, ganttTaskToCardUpdate, themes$1 as ganttThemes, gantt as ganttTokens, translations as ganttTranslations, ganttUtils, generateCSSVariables, generateCompleteCSS, generateInitialPositions, generateTasksContext, generateThemeVariables, getCalendarTheme, getCalendarTranslations, getListViewTheme, getListViewTranslations, getMonthNames, getToken, getTranslations, getWeekdayNames, kanban as kanbanTokens, lightTheme, lightTheme$1 as lightTokenTheme, lineHeight, darkTheme$3 as listViewDarkTheme, en$1 as listViewEnTranslations, es$1 as listViewEsTranslations, lightTheme$3 as listViewLightTheme, neutralTheme$3 as listViewNeutralTheme, listViewThemes, listViewTranslations, mergeCalendarTranslations, mergeListViewTranslations, mergeTranslations, neutralTheme, neutralTheme$1 as neutralTokenTheme, opacity, parseLocalCommand, parseNaturalDate, parseNaturalDuration, parseProgress, parseStatus, pluginManager, retrySyncOperation, retryWithBackoff, shadows, shouldVirtualizeGrid, spacing, themes, useAI, useBoard$1 as useBoard, useBoard as useBoardCore, useBoardStore, useCardStacking, useDragState, useFilteredCards, useFilters, useGanttI18n, useKanbanState, useKeyboardShortcuts, useMultiSelect, useSelectionState, useSortedCards, useTheme, useVirtualGrid, useVirtualList, validateAIResponse, withErrorBoundary, wouldCreateCircularDependency, zIndex };
6823
+ export { type AICallbacks, type AICommandResult, type GanttTask as AIGanttTask, type AIMessage, type AIModelKey, type AIOperation, AIUsageDashboard, type AIUsageDashboardProps, AI_FEATURES, AI_MODELS, type Activity, type ActivityType, AddCardButton, type AddCardButtonProps, type AddCardData, AddColumnButton, type AddColumnButtonProps, type AssigneeSuggestion, type Attachment, AttachmentUploader, type AttachmentUploaderProps, type AvailableUser, type Board, type BoardCallbacks, type BoardConfig, BoardProvider, type BoardProviderProps, type BorderRadiusToken, BulkOperationsToolbar, type BulkOperationsToolbarProps, BurnDownChart, type BurnDownChartProps, type BurnDownDataPoint, CUSTOM_FIELD_TYPES, CalendarBoard, type CalendarBoardProps, type CalendarCallbacks, type CalendarConfig, type CalendarDay, type CalendarEvent, type CalendarPermissions, type CalendarSupportedLocale, type CalendarTheme, type CalendarThemeName, type CalendarTranslations, type CalendarViewMode, Card, CardDetailModal, type CardDetailModalProps, CardDetailModalV2, type CardDetailModalV2Props, type CardFilter, type CardFilters, CardHistoryReplay, type CardHistoryReplayProps, CardHistoryTimeline, type CardHistoryTimelineProps, type CardProps, CardRelationshipsGraph, type CardRelationshipsGraphProps, type CardSort, type CardSortKey, CardStack, type CardStackProps, type CardStack$1 as CardStackType, type CardStatus, type CardTemplate, CardTemplateSelector, type CardTemplateSelectorProps, type CardTimeProps, type Card$1 as CardType, CircuitBreaker, Column, ColumnManager, type ColumnProps, type Column$1 as ColumnType, CommandPalette, type CommandPaletteProps, type Comment, type CommentAttachment, ConfigMenu, type ConfigMenuProps, ContextMenu, type ContextMenuAction, type ContextMenuState, type CustomFieldDefinition, type CustomFieldValue, DEFAULT_SHORTCUTS, DEFAULT_TABLE_COLUMNS, DEFAULT_TEMPLATES, type DateFilter, DateRangePicker, type DateRangePickerProps, DependenciesSelector, type DependenciesSelectorProps, DependencyLine, type DesignTokens, DistributionCharts, type DistributionChartsProps, type DistributionDataPoint, type DragData, type DropData, type DurationToken, type EasingToken, EditableColumnTitle, type EditableColumnTitleProps, ErrorBoundary, type ErrorBoundaryProps, ExportDropdown, type ExportFormat, ExportImportModal, type ExportImportModalProps, type ExportOptions, FilterBar, type FilterBarProps, type FilterState, type FlattenedTask, type FontSizeToken, type FontWeightToken, GANTT_AI_SYSTEM_PROMPT, GanttAIAssistant, type GanttAIAssistantConfig, type Assignee as GanttAssignee, GanttBoard, type GanttConfig as GanttBoardConfig, type GanttBoardRef, type GanttColumn, type ColumnType$1 as GanttColumnType, type GanttConfig, GanttI18nContext, Milestone as GanttMilestone, type GanttPermissions, type Task as GanttTask, type GanttTemplates, type Theme$1 as GanttTheme, type GanttTheme as GanttThemeConfig, GanttToolbar, type GanttTranslations, GenerateGanttTasksDialog, type GenerateGanttTasksDialogProps, GeneratePlanModal, type GeneratePlanModalProps, type GeneratedPlan, type GeneratedTasksResponse, type GroupByOption, GroupBySelector, type GroupBySelectorProps, HealthBar, type HealthBarProps, type IPluginManager, type ImportResult, type Insight, type InsightSeverity, type InsightType, KanbanBoard, type KanbanBoardProps, KanbanToolbar, type KanbanToolbarProps, KanbanViewAdapter, type KanbanViewConfig, type KeyboardAction, type KeyboardShortcut, KeyboardShortcutsHelp, type KeyboardShortcutsHelpProps, type LineHeightToken, type ListColumn, type ColumnType as ListColumnType, type ListFilter, type ListSort, type ListSortColumn, ListView, type ListViewCallbacks, type ListViewConfig, type ListViewPermissions, type ListViewProps, type ListViewSupportedLocale, type ListViewTheme, type ListViewThemeName, type ListViewTranslations, MenuIcons, type OpacityToken, type PendingFile, type PersistHistoryConfig, type Plugin, type PluginContext, type PluginHooks, PluginManager, type Priority, PrioritySelector, type PrioritySelectorProps, ProfitabilityReport, type ProfitabilityReportProps, type ProjectForecast, type ProjectHealthData, QuickTaskCreate, type QuickTaskCreateData, type QuickTaskCreateProps, RATE_LIMITS, type RenderProps, type RetryOptions, type RetryResult, STANDARD_FIELDS, type ShadowToken, type SortBy, type SortDirection, type SortOrder, type SortState, type SpacingToken, type StackSuggestion, type StackingConfig, type StackingStrategy, type Subtask, type SupportedLocale, type Swimlane, SwimlaneBoardView, type SwimlaneBoardViewProps, type SwimlaneConfig, type TableColumn, TagBadge, TagList, TagPicker, TaskBar, type TaskComment, TaskDetailModal, type TaskDetailModalProps, type TaskFilterType, type TaskFormData, TaskFormModal, type TaskFormModalProps, TaskGrid, type TaskPriority, type TaskTag, type Theme, type ThemeColors, type ThemeContextValue, ThemeModal, type ThemeModalProps, type ThemeName, ThemeProvider, ThemeSwitcher, type TimeEntry, TimeInputPopover, type TimeInputPopoverProps, type TimeLogInput, type TimeLogSource, TimePill, type TimePillProps, TimePopover, type TimePopoverProps, type TimeScale, type TimeTrackingBoardProps, type TimeTrackingCallbacks, type TimeTrackingSummary, Timeline, type TimerState, type ThemeColors$1 as TokenThemeColors, type TokenValue, type UsageStats, type UseAIOptions, type UseAIReturn, type UseBoardReturn as UseBoardCoreReturn, type UseBoardOptions, type UseBoardReturn$1 as UseBoardReturn, type UseCardStackingOptions, type UseCardStackingResult, type UseDragStateReturn, type UseFiltersOptions, type UseFiltersReturn, type UseKanbanStateOptions, type UseKanbanStateReturn, type UseKeyboardShortcutsOptions, type UseKeyboardShortcutsReturn, type UseMultiSelectReturn, type UseSelectionStateReturn, type User$1 as User, UserAssignmentSelector, type UserAssignmentSelectorProps, VelocityChart, type VelocityChartProps, type VelocityDataPoint, VirtualGrid, type VirtualGridProps, VirtualList, type VirtualListProps, type WeekDay, type ZIndexToken, aiUsageTracker, borderRadius, calculatePosition, darkTheme$2 as calendarDarkTheme, en as calendarEnTranslations, es as calendarEsTranslations, lightTheme$2 as calendarLightTheme, neutralTheme$2 as calendarNeutralTheme, calendarThemes, calendarTranslations, cardToGanttTask, cardsToGanttTasks, cn, createKanbanView, createRetryWrapper, darkTheme, darkTheme$1 as darkTokenTheme, defaultTheme, designTokens, duration, easing, exportTokensToCSS, findTaskByName, fontSize, fontWeight, formatCost, en$2 as ganttEnTranslations, es$2 as ganttEsTranslations, ganttTaskToCardUpdate, themes$1 as ganttThemes, gantt as ganttTokens, translations as ganttTranslations, ganttUtils, generateCSSVariables, generateCompleteCSS, generateInitialPositions, generateTasksContext, generateThemeVariables, getCalendarTheme, getCalendarTranslations, getListViewTheme, getListViewTranslations, getMonthNames, getToken, getTranslations, getWeekdayNames, kanban as kanbanTokens, lightTheme, lightTheme$1 as lightTokenTheme, lineHeight, darkTheme$3 as listViewDarkTheme, en$1 as listViewEnTranslations, es$1 as listViewEsTranslations, lightTheme$3 as listViewLightTheme, neutralTheme$3 as listViewNeutralTheme, listViewThemes, listViewTranslations, mergeCalendarTranslations, mergeListViewTranslations, mergeTranslations, neutralTheme, neutralTheme$1 as neutralTokenTheme, opacity, parseLocalCommand, parseNaturalDate, parseNaturalDuration, parseProgress, parseStatus, pluginManager, retrySyncOperation, retryWithBackoff, shadows, shouldVirtualizeGrid, spacing, themes, useAI, useBoard$1 as useBoard, useBoard as useBoardCore, useBoardStore, useCardStacking, useDragState, useFilteredCards, useFilters, useGanttI18n, useKanbanState, useKeyboardShortcuts, useMultiSelect, useSelectionState, useSortedCards, useTheme, useVirtualGrid, useVirtualList, validateAIResponse, withErrorBoundary, wouldCreateCircularDependency, zIndex };
package/dist/index.js CHANGED
@@ -365,7 +365,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
365
365
  }
366
366
  `})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Pe[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:xe,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${kt}`,boxShadow:xt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:nt,borderBottom:`1px solid ${ze}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ct,border:`1px solid ${et}`,color:"#2E94FF"},children:jsx(Tm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ee},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>m(I=>!I),className:"p-1.5 rounded-lg transition-colors",style:{color:V},onMouseEnter:I=>{I.currentTarget.style.background=U,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=V;},children:jsx($v,{})}),jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:V},onMouseEnter:I=>{I.currentTarget.style.background=U,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=V;},children:jsx(Rv,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:ae,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:ye.slice(0,4).map((I,ve)=>jsx("button",{onClick:()=>Oe(I),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ne,color:oe,border:`1px solid ${z}`},onMouseEnter:Z=>{Z.currentTarget.style.borderColor=Ge,Z.currentTarget.style.color="#2E94FF";},onMouseLeave:Z=>{Z.currentTarget.style.borderColor=z,Z.currentTarget.style.color=oe;},children:I.length>30?I.slice(0,30)+"...":I},ve))})]}),g.map(I=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?fe:$e,color:I.role==="user"?"#2E94FF":dt,border:I.role==="user"?`1px solid ${Ve}`:`1px solid ${Ue}`},children:[I.isLoading?jsx(Ov,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:I.command.success?"#10B981":"#EF4444",border:`1px solid ${I.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[I.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsx("div",{ref:Y})]}),jsxs("form",{onSubmit:I=>{if(A&&ut.length>0){I.preventDefault();return}Q(I);},className:"p-3 relative",style:{borderTop:`1px solid ${ot}`},children:[jsx(AnimatePresence,{children:A&&ut.length>0&&jsx(motion.div,{ref:G,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:gt,border:`1px solid ${Vt}`,boxShadow:ht,backdropFilter:"blur(12px)"},children:ut.map((I,ve)=>jsxs("button",{type:"button",onClick:()=>Pt(I),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ve===M?lt:"transparent",color:ne},onMouseEnter:()=>J(ve),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:$,border:`1px solid ${_}`,color:"#2E94FF"},children:I.name.split(" ").map(Z=>Z[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:I.name}),I.email&&jsx("div",{className:"text-xs truncate",style:{color:pe},children:I.email})]})]},I.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:it,border:`1px solid ${mt}`},children:[jsx("input",{ref:H,type:"text",value:x,onChange:I=>St(I.target.value),onKeyDown:I=>{At(I);},placeholder:Le,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Nt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?$t:"transparent",color:x.trim()?"#2E94FF":Mt,border:x.trim()?`1px solid ${Et}`:"1px solid transparent"},children:jsx(Bv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Ft,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Nm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,p=true)=>{r(d=>{let m=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:d}});},[]),c=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Dm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Wv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Se.formatDate(e.startDate)} - ${Se.formatDate(e.endDate)}`);let a=Se.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Sm(e){return {...Wv,...e}}var Xv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Fm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:p,projectName:d,availableUsers:m=[],templates:g,enableAutoCriticalPath:y=true,persistExpandedState:x,persistFilter:h,clearFiltersKey:f,aiAssistant:b,locale:w="en",customTranslations:C,showCreateTaskButton:S=false,createTaskLabel:E,onCreateTask:k,taskFilter:v,onTaskFilterChange:A,toolbarRightContent:L,showBaseline:M,viewMode:J,onViewModeChange:H,projectForecast:Y,onThemeChange:T,onTaskClick:G,onTaskDblClick:te,onTaskContextMenu:Le,onTaskUpdate:R,onDependentTasksScheduled:q,onProgressChange:ye,onTaskEdit:_e,onTaskAddSubtask:O,onTaskMarkIncomplete:ee,onTaskSetInProgress:le,onDependencyCreate:Ce,onDependencyDelete:we,onBeforeTaskAdd:Be,onAfterTaskAdd:He,onBeforeTaskUpdate:at,onAfterTaskUpdate:ue,onBeforeTaskDelete:je,onAfterTaskDelete:Xe,permissions:xe,onCopySnapshotLink:kt}=a,nt=useContext(ki)?.theme,[ze,ct]=useState(nt||s||"dark"),[et,Ee]=useState(n),[V,D]=useState(l),[U,ae]=useState(1),[Ne,z]=useState("all"),[oe,Ge]=useState(J||"execution"),fe=J??oe,Ve=useCallback(P=>{Ge(P),H?.(P);},[H]),$e=M??fe==="oracle",[Ue,dt]=useState(a.showCriticalPath!==false),[ot,it]=useState(a.showDependencies!==false),[mt,Nt]=useState(a.highlightWeekends!==false),$t=useCallback(P=>{dt(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),Et=useCallback(P=>{it(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),Mt=useCallback(P=>{Nt(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(et);},[et]),useEffect(()=>{a.onZoomChange?.(U);},[U]);let Ft=useRef(a.onDateRangeChange);Ft.current=a.onDateRangeChange;let gt=useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Vt,ht]=useState(()=>{if(!h)return "all";try{let P=typeof h=="string"?h:"gantt-filter-state",B=localStorage.getItem(P);if(B){let j=JSON.parse(B);if(j.taskFilter)return j.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),lt=v??Vt,ne=A??ht,[pe,$]=useState(()=>{if(!h)return false;try{let P=typeof h=="string"?h:"gantt-filter-state",B=localStorage.getItem(P);if(B){let j=JSON.parse(B);if(typeof j.hideCompleted=="boolean")return j.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});useEffect(()=>{let P=gt();if(P)try{let B={taskFilter:lt,hideCompleted:pe};localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving filter state to localStorage:",B);}},[lt,pe,gt]);let _=useRef(f);useEffect(()=>{if(_.current!==f&&f!==void 0){ht("all"),$(false);let P=gt();if(P)try{localStorage.removeItem(P);}catch(B){console.warn("[GanttBoard] Error clearing filter state from localStorage:",B);}}_.current=f;},[f,gt]);let[De,Qe]=useState(0),[ut,St]=useState(false),[Pt,At]=useState(null),[Qt,oa]=useState({isOpen:false,x:0,y:0,task:null}),[Q,Oe]=useState(null),[Pe,I]=useState(null);useEffect(()=>{nt&&nt!==ze&&ct(nt);},[nt]),useEffect(()=>{s&&s!==ze&&ct(s);},[s]);let ve=useCallback(P=>{ct(P),T?.(P);},[T]),{state:Z,setState:N,undo:K,redo:Te,canUndo:Ae,canRedo:Ot,clearHistory:Tt}=Nm(t,50),Jt=useMemo(()=>{let P=(B,j=0)=>{let X=j;for(let he of B)he.subtasks?.length&&(X=Math.max(X,P(he.subtasks,j+1)));return X};return P(Z)+1},[Z]),Wa=useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),ya=useRef(new Map),wa=useRef(false);if(!wa.current&&x){wa.current=true;let P=typeof x=="string"?x:"gantt-expanded-tasks";try{let B=localStorage.getItem(P);if(B){let j=JSON.parse(B);Array.isArray(j)&&(ya.current=new Map(j));}}catch(B){console.warn("[GanttBoard] Error loading expanded state from localStorage:",B);}}let dr=useCallback(()=>{let P=Wa();if(P)try{let B=Array.from(ya.current.entries());localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving expanded state to localStorage:",B);}},[Wa]),Ar=useRef(0),Zn=useRef(Z);useEffect(()=>{Zn.current=Z;},[Z]);let Wr=useRef(false),F=useCallback(P=>{z(P),Ar.current+=1,N(B=>{let j=(he,Me=0)=>he.map(Ct=>{let st=P==="all"||Me<P-1;return Ct.subtasks?.length&&ya.current.set(Ct.id,st),{...Ct,isExpanded:st,subtasks:Ct.subtasks?j(Ct.subtasks,Me+1):void 0}}),X=j(B);return dr(),X});},[N,dr]);useEffect(()=>{if(Ar.current>0){Ar.current-=1;return}let P=j=>{let X=new Map;for(let he of j){let Me=he.id;X.get(Me)||X.set(Me,he);}return Array.from(X.values())},B=j=>j.map(X=>{let he=ya.current.get(X.id),Me=he!==void 0?{...X,isExpanded:he}:X;if(Me.subtasks?.length){let Ct=P(Me.subtasks);return {...Me,subtasks:B(Ct)}}return Me});if(ya.current.size>0)N(Or(B(t)));else {let j=X=>X.map(he=>he.subtasks?.length?{...he,subtasks:P(j(he.subtasks))}:he);N(Or(j(t)));}},[t,N]);let se=useRef(t),ge=useRef(true);useEffect(()=>{if(ge.current){ge.current=false,se.current=Z;return}if(Wr.current){Wr.current=false,se.current=Z;return}if(!r)return;let P=JSON.stringify(se.current),B=JSON.stringify(Z);P!==B&&(se.current=Z,r(Z));},[Z,r]);let ke=useMemo(()=>kd(w,C),[w,C]),Re=useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[tt,me]=useState(()=>Re(ke));useEffect(()=>{me(P=>P.map(B=>({...B,label:ke.columns[B.id==="name"?"taskName":B.id]||B.label})));},[ke]);let Ke=useMemo(()=>tt.filter(B=>B.visible).reduce((B,j)=>B+j.width,0),[tt]),Ze=useRef(tt.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=tt.filter(X=>X.visible),B=P.map(X=>X.id).join(","),j=Ze.current;if(B!==j){let X=P.some(Me=>Me.id!=="name"),he=j.includes(",");X?!he&&X&&At(null):At(null),Ze.current=B;}},[tt]);let yt=60,na=.6,jt=useMemo(()=>{let B=Ke+yt,j=typeof window<"u"?window.innerWidth*na:800,X=Math.max(B,j);return Pt!==null?Math.max(200,Math.min(Pt,X)):Math.max(200,B)},[Pt,Ke]),Ut=useRef(null),sa=useRef(null),_t=useRef(null),Ba=useRef(null),Dt=useMemo(()=>Gp(ze),[ze]),mr=useMemo(()=>({theme:Dt,themeName:ze}),[Dt,ze]),No=useMemo(()=>Sm(g),[g]),Vr=useMemo(()=>{if(!y)return Z;let P=Se.calculateCriticalPathFull(Z),B=j=>j.map(X=>{let he=P.get(X.id),Me=X.subtasks?B(X.subtasks):void 0,Ct=Me?.some(ka=>ka.isCriticalPath||ka.subtasks&&ka.subtasks.some(Zt=>Zt.isCriticalPath))||false,st=he?he.isCritical:Ct;return {...X,isCriticalPath:st,cpmData:he||void 0,subtasks:Me}});return B(Z)},[Z,y]),Do=useMemo(()=>Se.flattenTasks(Z).some(B=>B.dependencies&&B.dependencies.length>0),[Z]),fo=useMemo(()=>{let P=(B,j="")=>[...B].sort((he,Me)=>(he.position??0)-(Me.position??0)).map((he,Me)=>{let Ct=Me+1,st=j?`${j}.${Ct}`:`${Ct}.0`,ka=j?`${j}.${Ct}`:`${Ct}`;return {...he,wbsCode:st,subtasks:he.subtasks?.length?P(he.subtasks,ka):he.subtasks}});return P(Vr)},[Vr]),Xc=useMemo(()=>{if(lt==="all"&&!pe)return fo;let P=B=>{let j=[];for(let X of B){let he=X.subtasks?.length?P(X.subtasks):void 0,Me=false;if(pe)Me=X.progress<100;else switch(lt){case "all":Me=true;break;case "incomplete":Me=X.progress<100;break;case "in_progress":Me=X.progress>0&&X.progress<100;break;case "completed":Me=X.progress===100;break}(Me||he&&he.length>0)&&j.push({...X,subtasks:he});}return j};return P(fo)},[fo,lt,pe]),Gs=Xv(V);Dm({undo:K,redo:Te,canUndo:Ae,canRedo:Ot,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>Se.findTaskById(Z,P),addTask:(P,B)=>{N(j=>{if(!B)return [...j,{...P,level:0}];let X=he=>he.map(Me=>Me.id===B?{...Me,subtasks:[...Me.subtasks||[],{...P,parentId:B,level:(Me.level||0)+1}],isExpanded:true}:Me.subtasks?{...Me,subtasks:X(Me.subtasks)}:Me);return X(j)});},updateTask:(P,B)=>{N(j=>{let X=he=>he.map(Me=>Me.id===P?{...Me,...B}:Me.subtasks?{...Me,subtasks:X(Me.subtasks)}:Me);return X(j)});},deleteTask:P=>{N(B=>{let j=X=>X.filter(he=>he.id===P?false:(he.subtasks&&(he.subtasks=j(he.subtasks)),true));return j(B)});},deleteTasks:P=>{N(B=>Pd(B,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let B=Se.findTaskById(Z,P);B&&a.onTaskDuplicate(B);}else N(B=>ws(B,[P]).tasks);},splitTask:(P,B,j=3)=>{N(X=>Se.splitTask(X,P,B,j));},calculateEndDate:Se.calculateEndDate,calculateDuration:Se.calculateDuration,validateDependency:(P,B)=>!Se.validateDependencies(Z,P,B),getAllTasks:()=>Se.flattenTasks(Z),getTasksByStatus:P=>Se.flattenTasks(Z).filter(B=>B.status===P),getTasksByParent:P=>P?Se.findTaskById(Z,P)?.subtasks||[]:Z.filter(j=>!j.parentId),getCriticalPath:()=>Se.flattenTasks(Z).filter(P=>P.isCriticalPath),indentTask:P=>{N(B=>Or(Ed(B,[P])));},outdentTask:P=>{N(B=>Or(Md(B,[P])));},moveTask:(P,B)=>{N(j=>Fd(j,[P],B));},createSubtask:async P=>{let{tasks:B,newTask:j}=Id(Z,P);if(Be){let X=Be({...j,parentId:P});if((X instanceof Promise?await X:X)===false)return}N(Or(B)),He&&He({...j,parentId:P});},scrollToTask:P=>{let j=Se.flattenTasks(Z).findIndex(X=>X.id===P);if(j!==-1&&Ut.current){let X=j*Gs;Ut.current.scrollTo({top:X,behavior:"smooth"}),_t.current&&_t.current.scrollTo({top:X,behavior:"smooth"});}},highlightTask:(P,B=2e3)=>{},expandTask:P=>{N(B=>{let j=X=>X.map(he=>he.id===P?{...he,isExpanded:true}:he.subtasks?{...he,subtasks:j(he.subtasks)}:he);return j(B)});},collapseTask:P=>{N(B=>{let j=X=>X.map(he=>he.id===P?{...he,isExpanded:false}:he.subtasks?{...he,subtasks:j(he.subtasks)}:he);return j(B)});},expandAll:()=>{N(P=>{let B=j=>j.map(X=>({...X,isExpanded:true,subtasks:X.subtasks?B(X.subtasks):void 0}));return B(P)});},collapseAll:()=>{N(P=>{let B=j=>j.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?B(X.subtasks):void 0}));return B(P)});},collapseToLevel:P=>{F(P);},undo:K,redo:Te,canUndo:()=>Ae,canRedo:()=>Ot,clearHistory:Tt,exportToPNG:async()=>{if(!Ba.current||!Ut.current||!_t.current)throw new Error("Gantt container not found");let P=Ba.current,B=Ut.current,j=sa.current||B.querySelector(".gantt-grid-scroll"),X=_t.current,he=j?.scrollTop||0,Me=X.scrollTop,Ct=P.style.overflow,st=P.style.height,ka=B.style.overflow;try{let Zt=j?.querySelector(".gantt-taskgrid-content"),fa=X.querySelector("svg"),lr=Zt?.scrollHeight||j?.scrollHeight||600,Sr=fa?.getBoundingClientRect().height||X.scrollHeight,Xo=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(lr,Sr)+20;j&&(j.scrollTop=0),X.scrollTop=0,P.style.overflow="visible",P.style.height=`${Xo}px`,B.style.overflow="visible",await new Promise(wn=>setTimeout(wn,100));let ro=await toPng(P,{backgroundColor:Dt.bgPrimary,pixelRatio:2,filter:wn=>{if(!(wn instanceof Element))return !0;let js=window.getComputedStyle(wn),ts=parseInt(js.zIndex,10);return (isNaN(ts)||ts<50)&&js.position!=="fixed"}});return await(await fetch(ro)).blob()}finally{P.style.overflow=Ct,P.style.height=st,B.style.overflow=ka,j&&(j.scrollTop=he),X.scrollTop=Me;}},exportToPDF:async P=>{await Se.exportToPDF(Z,P);},exportToExcel:async P=>{await Se.exportToExcel(Z,P,fl.current);},exportToJSON:()=>Se.exportToJSON(Z),exportToCSV:()=>Se.exportToCSV(Z),importFromJSON:P=>{let B=Se.importFromJSON(P);N(B);},getTasks:()=>Z,refresh:()=>{N(P=>[...P]);},clearAll:()=>{N([]);}}),[Z,K,Te,Ae,Ot,Tt,Dt,Gs]);let df=useCallback(P=>{me(B=>B.map(j=>j.id===P?{...j,visible:!j.visible}:j));},[]),cf=useCallback((P,B)=>{me(j=>j.map(X=>{if(X.id!==P)return X;let he=X.minWidth??100,Me=X.maxWidth??800,Ct=Math.max(he,Math.min(Me,B));return {...X,width:Ct}}));},[]),uf=useCallback(P=>{N(B=>{let j=Ld(B,P),X=he=>{for(let Me of he){if(Me.id===P){ya.current.set(P,Me.isExpanded??true);return}Me.subtasks?.length&&X(Me.subtasks);}};return X(j),dr(),j}),a.onTaskToggleExpand?.(P);},[a,dr]),So=useCallback((P,B)=>{if(at&&at(P,B)===false)return;let X=Se.findTaskById(Z,P)?.progress,he=Ct=>Ct.map(st=>st.id===P?{...st,...B}:st.subtasks?{...st,subtasks:he(st.subtasks)}:st);N(he(Z));let Me=Se.findTaskById(he(Z),P);Me&&(R?.(Me),ue?.(Me),B.progress!==void 0&&X!==void 0&&B.progress!==X&&ye?.(P,X,B.progress));},[Z,R,at,ue,ye]),pf=useCallback(P=>{P.length!==0&&(Ar.current+=1,Wr.current=true,N(B=>Or(Ed(B,P))),a.onTaskIndent?.(P[0]));},[a]),mf=useCallback(P=>{P.length!==0&&(Ar.current+=1,Wr.current=true,N(B=>Or(Md(B,P))),a.onTaskOutdent?.(P[0]));},[a]),gf=useCallback((P,B,j)=>{Ar.current+=1,Wr.current=true,N(X=>Or(pm(X,P,B,j))),a.onTaskReparent?.(P,B,j);},[a]),ff=useCallback((P,B)=>{P.length!==0&&(Ar.current+=1,Wr.current=true,N(j=>Fd(j,P,B)),a.onTaskMove?.(P[0],B));},[a]),pl=useCallback(async P=>{let B=[];for(let j of P)je&&await Promise.resolve(je(j))===false||B.push(j);B.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(B):(N(j=>Or(Pd(j,B))),B.forEach(j=>a.onTaskDelete?.(j))),Xe&&B.forEach(j=>Xe(j)));},[a,je,Xe]),bf=useCallback(P=>{a.onTaskDuplicate?P.forEach(B=>{let j=Se.findTaskById(Z,B);j&&a.onTaskDuplicate(j);}):N(B=>ws(B,P).tasks);},[a,Z]),hf=useCallback((P,B)=>{N(j=>{let{tasks:X,newTask:he}=um(j,P,B);return Be&&Be(he)===false?j:(a.onTaskCreate?.(he.parentId,he.position||0),He?.(he),X)});},[a,Be,He]),yf=useCallback((P,B)=>{N(j=>Ad(j,P,B)),a.onTaskRename?.(P,B);},[a]),ml=useCallback(P=>{let{onTaskAddSubtask:B}=a;if(B){let j=On(Z,P);if(j){B(j);return}}N(j=>{let{tasks:X}=Id(j,P);return a.onTaskCreate?.(P,0),X});},[a,Z]),xf=useCallback((P,B)=>{let j=Math.max(0,Math.min(100,Math.round(B))),X={progress:j};j===100?X.status="completed":j>0?X.status="in-progress":X.status="todo",So(P.id,X);},[So]),vf=useCallback((P,B,j)=>{let X=!P.startDate&&!P.endDate,he=P.startDate?Math.round((B.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Me=Zt=>Zt.map(fa=>fa.id===P.id?{...fa,startDate:B,endDate:j,...P.segments&&{segments:P.segments}}:fa.subtasks?{...fa,subtasks:Me(fa.subtasks)}:fa),Ct=Me(Z),st=Ct;Ct=Se.autoScheduleDependents(Ct,P.id,he),Ct=Or(Ct),N(Ct);let ka={...P,startDate:B,endDate:j};if(X&&a?.onTaskDateChange?a.onTaskDateChange(P,B,j):R?.(ka),q&&he!==0){let Zt=Se.flattenTasks(st),fa=Se.flattenTasks(Ct),lr=[];for(let Sr of fa){if(Sr.id===P.id)continue;let Eo=Zt.find(ro=>ro.id===Sr.id);if(!Eo)continue;let vn=Sr.startDate?.getTime()!==Eo.startDate?.getTime(),Xo=Sr.endDate?.getTime()!==Eo.endDate?.getTime();(vn||Xo)&&lr.push(Sr);}lr.length>0&&q(lr);}},[Z,R,q,a]),wf=useCallback((P,B)=>{Le?.(P,B),oa({isOpen:true,x:B.clientX,y:B.clientY,task:P});},[Le]),kf=useCallback((P,B)=>{let j=Se.splitTask(Z,P.id,B);N(j),oa({isOpen:false,x:0,y:0,task:null});},[Z]),Jc=useCallback(P=>{let B=Se.findTaskById(Z,P.id)||P;te?.(B),_e||Oe(B);},[Z,te,_e]),Qc=useCallback((P,B,j)=>{let X=new Map,he=Zt=>{Zt.forEach(fa=>{fa.dependencies&&X.set(fa.id,fa.dependencies),fa.subtasks&&he(fa.subtasks);});};he(j);let Me=X.get(B)||[];X.set(B,[...Me,P]);let Ct=new Set,st=new Set,ka=Zt=>{if(!Ct.has(Zt)){Ct.add(Zt),st.add(Zt);let fa=X.get(Zt)||[];for(let lr of fa){if(!Ct.has(lr)&&ka(lr))return true;if(st.has(lr))return true}}return st.delete(Zt),false};return ka(B)},[]),Zc=useCallback((P,B)=>{if(Qc(P.id,B,Zn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
367
367
 
368
- Task dependencies must flow in one direction only.`);return}let j=X=>X.map(he=>{if(he.id===B){let Me=he.dependencies||[];if(!Me.includes(P.id))return {...he,dependencies:[...Me,P.id]}}return he.subtasks?{...he,subtasks:j(he.subtasks)}:he});Ar.current+=1,N(X=>j(X)),Ce?.(P.id,B);},[Ce,Qc]),eu=useCallback((P,B)=>{let j=X=>X.map(he=>{if(he.id===P&&he.dependencies){let Me=he.dependencies.filter(Ct=>Ct!==B);return {...he,dependencies:Me}}return he.subtasks?{...he,subtasks:j(he.subtasks)}:he});Ar.current+=1,N(X=>j(X)),we?.(P,B);},[we]),{startDate:yn,endDate:gl}=useMemo(()=>{let P=Z.filter(Me=>Me.startDate&&Me.endDate);if(P.length===0){let Me=new Date,Ct=new Date(Me);Ct.setDate(Ct.getDate()-30);let st=new Date(Me);return st.setDate(st.getDate()+60),{startDate:Ct,endDate:st}}let B=P.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),j=new Date(Math.min(...B.map(Me=>Me.getTime()))),X=new Date(Math.max(...B.map(Me=>Me.getTime()))),he=et==="day"?7:et==="week"?14:30;return j.setDate(j.getDate()-he),X.setDate(X.getDate()+he),{startDate:j,endDate:X}},[Z,et]);useEffect(()=>{Ft.current?.(yn,gl);},[yn,gl]);let Cf=useCallback(async()=>{if(!Ba.current||!Ut.current||!_t.current)return;await new Promise(Xo=>setTimeout(Xo,200));let P=Ba.current,B=Ut.current,j=sa.current||B.querySelector(".gantt-grid-scroll"),X=_t.current,he=j?.scrollTop||0,Me=j?.scrollLeft||0,Ct=X.scrollTop,st=X.scrollLeft,ka=P.style.overflow,Zt=P.style.height,fa=j?.style.overflow||"",lr=X.style.overflow,Sr=B.style.overflow,Eo=P.style.width,vn=X.style.width;try{let Xo=j?.querySelector(".gantt-taskgrid-content"),ro=X.querySelector("svg"),hl=ro?.getAttribute("height")?parseInt(ro.getAttribute("height"),10):ro?.getBoundingClientRect().height||0,wn=Xo?.scrollHeight||j?.scrollHeight||600,js=Math.max(hl,X.scrollHeight),ts=ro?.getAttribute("width")?parseInt(ro.getAttribute("width"),10):ro?.getBoundingClientRect().width||X.scrollWidth,Pf=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,yl=Math.max(wn,js,hl),ru=Pf+yl+50,ou=(j?.offsetWidth||B.offsetWidth||300)+ts+10;j&&(j.scrollTop=0,j.scrollLeft=0),X.scrollTop=0,X.scrollLeft=0,P.style.overflow="visible",P.style.height=`${ru}px`,P.style.width=`${ou}px`,B.style.overflow="visible",j&&(j.style.overflow="visible",j.style.height=`${yl+50}px`),X.style.overflow="visible",X.style.height=`${yl+50}px`,X.style.width=`${ts+10}px`,await new Promise(_s=>setTimeout(_s,150));let Af=await toPng(P,{backgroundColor:Dt.bgPrimary,pixelRatio:2,width:ou,height:ru,skipFonts:!1,filter:_s=>{if(!(_s instanceof Element))return !0;let nu=window.getComputedStyle(_s),su=parseInt(nu.zIndex,10);return !(!isNaN(su)&&su>=50||nu.position==="fixed")}}),xl=document.createElement("a");xl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,xl.href=Af,xl.click();}finally{P.style.overflow=ka,P.style.height=Zt,P.style.width=Eo,B.style.overflow=Sr,j&&(j.style.overflow=fa,j.style.height="",j.scrollTop=he,j.scrollLeft=Me),X.style.overflow=lr,X.style.height="",X.style.width=vn,X.scrollTop=Ct,X.scrollLeft=st;}p?.("png");},[Dt,p]),Tf=useCallback(async()=>{await Se.exportToPDF(Z),p?.("pdf");},[Z,p]),fl=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d});fl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d};let Nf=useCallback(async()=>{let P=new Date,B=he=>String(he).padStart(2,"0"),j=`${P.getFullYear()}-${B(P.getMonth()+1)}-${B(P.getDate())}_${B(P.getHours())}${B(P.getMinutes())}`,X=d?d.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(Z,`${X}_${j}.xlsx`,fl.current),p?.("excel");},[Z,d,p]),Df=useCallback(()=>{let P=Se.exportToCSV(Z),B=new Blob([P],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(B),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href),p?.("csv");},[Z,p]),Sf=useCallback(()=>{let P=Se.exportToJSON(Z),B=new Blob([P],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(B),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href),p?.("json");},[Z,p]),Ef=useCallback(()=>{Se.exportToMSProject(Z,"Gantt Project","project.xml"),p?.("msproject");},[Z,p]),Mf=P=>{P.preventDefault(),St(true);},xn=useRef(false),[bl,tu]=useState(false),es=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=_t.current,B=Ut.current?.querySelector(".gantt-grid-scroll");if(!P||!B)return;let j=()=>{if(xn.current)return;xn.current=true;let st=P.scrollTop;Qe(st),B.scrollTop=st,requestAnimationFrame(()=>{xn.current=false;});},X=()=>{if(xn.current)return;xn.current=true;let st=B.scrollTop;Qe(st),P.scrollTop=st,requestAnimationFrame(()=>{xn.current=false;});},he=st=>{if(ut&&B){let Zt=B.parentElement?.getBoundingClientRect()?.left||0,fa=st.clientX-Zt,lr=200,Sr=Ke+yt,Eo=window.innerWidth*na,vn=Math.max(Sr,Eo);fa>=lr&&fa<=vn&&At(fa);}if(bl&&P){let ka=st.clientX-es.current.x,Zt=st.clientY-es.current.y;P.scrollLeft=es.current.scrollLeft-ka,P.scrollTop=es.current.scrollTop-Zt;}},Me=()=>{St(false),tu(false);},Ct=st=>{if(st.button!==0)return;let ka=st.target;ka.closest("[data-task-bar]")||ka.closest("[data-dependency-line]")||ka.closest("button")||ka.closest('[role="button"]')||ka.tagName==="rect"&&ka.getAttribute("data-clickable")==="true"||(tu(true),es.current={x:st.clientX,y:st.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},st.preventDefault());};return P.addEventListener("scroll",j),B.addEventListener("scroll",X),P.addEventListener("mousedown",Ct),document.addEventListener("mousemove",he),document.addEventListener("mouseup",Me),()=>{P.removeEventListener("scroll",j),B.removeEventListener("scroll",X),P.removeEventListener("mousedown",Ct),document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Me);}},[ut,bl,Ke]);let au=useRef(false),Ff=useRef(null);return useLayoutEffect(()=>{if(au.current||Z.length===0||!_t.current)return;au.current=true,Ff.current=yn;let P=_t.current,B=new Date,j=et==="day"?60:et==="week"?20:8,X=(B.getTime()-yn.getTime())/(1e3*60*60*24),he=P.clientWidth,Ct=X*j*U-he/2;X>=0&&he>0&&(P.scrollLeft=Math.max(0,Ct));},[Z.length,yn,et,U]),jsx(In.Provider,{value:ke,children:jsx(Tl.Provider,{value:mr,children:jsxs("div",{ref:Ba,className:"flex flex-col h-full w-full",style:{backgroundColor:Dt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Dt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Dt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Ti,{theme:Dt,timeScale:et,onTimeScaleChange:Ee,zoom:U,onZoomChange:ae,currentTheme:ze,onThemeChange:ve,rowDensity:V,onRowDensityChange:D,showThemeSelector:c,showCreateTaskButton:S&&xe?.canCreateTask!==false&&!xe?.canCreateSubtaskOnly,createTaskLabel:E,onCreateTask:k,taskFilter:lt,onTaskFilterChange:ne,hideCompleted:pe,onHideCompletedChange:$,toolbarRightContent:L,wbsLevel:Ne,onWbsLevelChange:F,maxWbsDepth:Jt,viewMode:fe,onViewModeChange:Ve,projectForecast:Y,onExportPNG:i?Cf:void 0,onExportPDF:i?Tf:void 0,onExportExcel:i?Nf:void 0,onExportCSV:i?Df:void 0,onExportJSON:i?Sf:void 0,onExportMSProject:i?Ef:void 0,showCriticalPath:Ue,onShowCriticalPathChange:$t,showDependencies:ot,onShowDependenciesChange:Et,highlightWeekends:mt,onHighlightWeekendsChange:Mt,showBaseline:$e,onShowBaselineChange:P=>{P&&fe!=="oracle"&&Ve("oracle"),!P&&fe==="oracle"&&Ve("execution");},onCopySnapshotLink:kt,hasDependencies:Do})}),jsxs("div",{ref:Ut,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:sa,className:"gantt-grid-scroll flex-shrink-0",style:{width:jt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Si,{tasks:Xc,theme:Dt,rowHeight:Gs,availableUsers:m,templates:No,showCriticalPath:Ue,onTaskClick:G,onTaskDblClick:Jc,onTaskContextMenu:Le,onTaskToggle:uf,scrollTop:De,columns:tt,onToggleColumn:df,onColumnResize:cf,onTaskUpdate:So,onTaskIndent:pf,onTaskOutdent:mf,onTaskMove:ff,onMultiTaskDelete:pl,onTaskDuplicate:bf,onTaskCreate:hf,onTaskRename:yf,onCreateSubtask:ml,onOpenTaskModal:G?P=>G(P):void 0,onDeleteRequest:(P,B)=>I({taskId:P,taskName:B}),onTaskReparent:gf,scrollContainerRef:sa})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Dt.border,zIndex:15},onMouseDown:Mf}),jsx("div",{ref:_t,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:bl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Bi,{tasks:Xc,theme:Dt,rowHeight:Gs,timeScale:et,startDate:yn,endDate:gl,zoom:U,locale:w,templates:No,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:G,onTaskDblClick:Jc,onTaskContextMenu:wf,onTaskDateChange:vf,onTaskProgressDrag:xf,onDependencyCreate:Zc,onDependencyDelete:eu,showBaseline:$e,showCriticalPath:Ue,showDependencies:ot,highlightWeekends:mt,canEditTask:xe?.canEditTask})})]}),Qt.task&&jsx(Rn,{isOpen:Qt.isOpen,x:Qt.x,y:Qt.y,theme:Dt,onClose:()=>oa({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Qt.task;if(!P)return [];let B=Se.findTaskById(Z,P.id)||P,j=B.subtasks&&B.subtasks.length>0,X=xe?.canCreateTask!==false,he=xe?.canDeleteTask!==false;if(j){let Zt=[],fa=xe?.canDuplicateTask!==false;return X&&Zt.push({id:"addSubtask",label:ke.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{O?O(B):ml(B.id);}}),fa&&Zt.push({id:"duplicate",label:ke.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):N(lr=>ws(lr,[B.id]).tasks),oa({isOpen:false,x:0,y:0,task:null});}}),he&&(Zt.length>0&&Zt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Zt.push({id:"delete",label:ke.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:B.id,taskName:B.name});}})),Zt}let Me=xe?.canUpdateTask!==false,Ct=xe?.canDuplicateTask!==false,st=[];return Me&&st.push({id:"edit",label:ke.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{_e?_e(B):Oe(B);}}),X&&st.push({id:"addSubtask",label:ke.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{O?O(B):ml(B.id);}}),st.length>0&&Me&&st.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Me&&(st.push({id:"markIncomplete",label:ke.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{ee?ee(B):So(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"}),st.push({id:"setInProgress",label:ke.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{le?le(B):So(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"}),st.push({id:"markComplete",label:ke.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{So(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"})),(Ct||Me&&B.startDate&&B.endDate)&&st.length>0&&st.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ct&&st.push({id:"duplicate",label:ke.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):N(Zt=>ws(Zt,[B.id]).tasks),oa({isOpen:false,x:0,y:0,task:null});}}),Me&&B.startDate&&B.endDate&&st.push({id:"split",label:ke.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{let Zt=B.startDate.getTime(),fa=B.endDate.getTime(),lr=Zt+(fa-Zt)/2,Sr=new Date(lr);kf(B,Sr);}}),he&&(st.length>0&&st.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),st.push({id:"delete",label:ke.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:B.id,taskName:B.name});}})),st})()}),jsx(yo,{task:Q,isOpen:!!Q,onClose:()=>Oe(null),onTaskUpdate:P=>{Q&&(So(Q.id,P),Oe(null));},theme:ze==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsx(AnimatePresence,{children:Pe&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>I(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Dt.bgSecondary,border:`1px solid ${Dt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Dt.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:Dt.textPrimary,fontFamily:"Inter, sans-serif"},children:[ke.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Dt.textPrimary},children:['"',Pe.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Dt.bgPrimary,borderTop:`1px solid ${Dt.border}`},children:[jsx("button",{onClick:()=>I(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Dt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{pl([Pe.taskId]),I(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsx(Oi,{tasks:Z,theme:Dt,config:b,onTasksUpdate:N,onTaskUpdate:So,onTaskCreate:P=>{N(B=>[...B,P]);},onTaskDelete:P=>{pl([P]);},onDependencyCreate:(P,B)=>{let j=Se.findTaskById(Z,P);j&&Zc(j,B);},onDependencyDelete:eu})]})})})});function i2(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function l2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var $d=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Od=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Lm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...$d,...i.filter(D=>!$d.some(U=>U.id===D.id))],f=ft[c]||ft.dark,[b,w]=useState(false),[C,S]=useState(false),[E,k]=useState(false),[v,A]=useState(false),[L,M]=useState({top:0,left:0}),[J,H]=useState(null),[Y,T]=useState(new Date),[G,te]=useState({top:0,left:0}),[Le,R]=useState(false),[q,ye]=useState([]),[_e,O]=useState(false),[ee,le]=useState(""),Ce=useRef(null),we=useRef(null),Be=useRef(null),He=useRef(null),at=useRef(null),[ue,je]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Xe,xe]=useState({});useEffect(()=>{a?(je({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(je({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),ye([]));},[a,e,x]),useEffect(()=>{let D=U=>{Ce.current&&!Ce.current.contains(U.target)&&w(false),we.current&&!we.current.contains(U.target)&&S(false),Be.current&&!Be.current.contains(U.target)&&k(false),He.current&&!He.current.contains(U.target)&&A(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let kt=()=>{let D={};return ue.name.trim()||(D.name="El nombre es requerido"),ue.startDate&&ue.endDate&&ue.startDate>ue.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),xe(D),Object.keys(D).length===0},xt=async D=>{if(D.preventDefault(),!!kt())try{let U=l==="create"&&q.length>0?{...ue,pendingFiles:q}:ue;await s(U),ye([]),t();}catch(U){console.error("Error submitting task:",U);}},nt=(D,U)=>{je(ae=>{let Ne={...ae,[D]:U};if(D==="status"){let z=U;z==="todo"?Ne.progress=0:z==="in-progress"?(ae.progress===0||ae.progress===100)&&(Ne.progress=50):z==="completed"||z==="closed"?Ne.progress=100:(z==="in-review"||z==="review")&&(Ne.progress=75);}if(D==="progress"){let z=typeof U=="number"?U:parseInt(U,10);z===100&&ae.status!=="completed"?Ne.status="completed":z>0&&z<100&&ae.status==="todo"?Ne.status="in-progress":z===0&&ae.status!=="todo"&&(Ne.status="todo");}return Ne}),Xe[D]&&xe(ae=>{let Ne={...ae};return delete Ne[D],Ne});},ze=h.find(D=>D.id===ue.status)??$d[0],ct=Od.find(D=>D.id===ue.priority)??Od[1],et=an.find(D=>D.value===ue.color)??an[0],Ee=c==="dark",V={backgroundColor:Ee?"#1d1f27":f.bgSecondary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Ee?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.border}`,boxShadow:Ee?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:D=>D.stopPropagation(),children:jsxs("form",{onSubmit:xt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ue.name,onChange:D=>nt("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Xe.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Xe.name]}),jsx("textarea",{value:ue.description||"",onChange:D=>nt("description",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Ce,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:ze.color,backgroundColor:`${ze.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:ze.color}}),jsx("span",{style:{color:ze.color},children:ze.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:ze.color}})]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("status",D.id),w(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ue.status===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxs("div",{ref:we,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&S(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsx("span",{children:ct.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Od.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("priority",D.id),S(false);},children:[jsx("span",{children:D.icon}),D.label,ue.priority===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!E),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[ue.assignees&&ue.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ue.assignees.slice(0,3).map((D,U)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},U))}),ue.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",ue.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let U=ue.assignees?.some(ae=>ae.name===D.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ae=U?(ue.assignees||[]).filter(Ne=>Ne.name!==D.name):[...ue.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Ne=>Ne[0]).join("").toUpperCase().slice(0,2),color:f.accent}];nt("assignees",ae);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:D.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:D.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:U&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxs("div",{ref:He,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(v)A(false);else {if(He.current){let D=He.current.getBoundingClientRect(),U=window.innerHeight,ae=120,z=U-D.bottom<ae?D.top-ae-8:D.bottom+8;M({top:z,left:D.left});}A(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ue.color}}),jsx("span",{children:et.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:v&&jsxs(ea,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>A(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${L.top}px`,left:`${L.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:an.slice(0,18).map(D=>{let U=ue.color===D.value;return jsx("button",{type:"button",onClick:ae=>{ae.preventDefault(),ae.stopPropagation(),nt("color",D.value),A(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:U?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),p.length>0||d?jsx(Ao,{selectedTags:ue.tags||[],availableTags:p,onChange:D=>nt("tags",D),onCreateTag:d,theme:f,disabled:n}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Ee?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${Ee?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxs("div",{ref:at,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ue.isMilestone)if(J==="start")H(null);else {if(at.current){let D=at.current.getBoundingClientRect();te({top:D.bottom+8,left:Math.max(16,D.left-40)});}H("start"),T(ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:n||ue.isMilestone,children:ue.startDate?ue.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ue.isMilestone)if(J==="end")H(null);else {if(at.current){let D=at.current.getBoundingClientRect();te({top:D.bottom+8,left:Math.max(16,D.left-40)});}H("end"),T(ue.endDate||ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:n||ue.isMilestone,children:ue.endDate?ue.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:J&&jsxs(ea,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${G.top}px`,left:`${G.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":f.bgPrimary,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Ee?"#262626":f.border}`},children:[(()=>{let D=new Date,U=new Date(D);U.setDate(D.getDate()+1);let ae=new Date(D);ae.setDate(D.getDate()+7);let Ne=new Date(D);return Ne.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:U},{label:"Pr\xF3xima semana",date:ae},{label:"2 semanas",date:Ne}].map((oe,Ge)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:fe=>fe.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{J==="start"?(nt("startDate",oe.date),(!ue.endDate||oe.date>ue.endDate)&&nt("endDate",oe.date),H("end")):(nt("endDate",oe.date),(!ue.startDate||oe.date<ue.startDate)&&nt("startDate",oe.date),H(null));},children:oe.label},Ge))})(),jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("startDate",void 0),nt("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>T(new Date(Y.getFullYear(),Y.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:Y.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>T(new Date(Y.getFullYear(),Y.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,U)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},U))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=Y.getFullYear(),U=Y.getMonth(),ae=new Date(D,U,1).getDay(),Ne=new Date(D,U+1,0).getDate(),z=new Date,oe=[];for(let fe=ae-1;fe>=0;fe--)oe.push({day:new Date(D,U,-fe).getDate(),date:new Date(D,U-1,new Date(D,U,-fe).getDate()),isCurrentMonth:false});for(let fe=1;fe<=Ne;fe++)oe.push({day:fe,date:new Date(D,U,fe),isCurrentMonth:true});let Ge=42-oe.length;for(let fe=1;fe<=Ge;fe++)oe.push({day:fe,date:new Date(D,U+1,fe),isCurrentMonth:false});return oe.map((fe,Ve)=>{let $e=fe.date.toDateString()===z.toDateString(),Ue=ue.startDate?.toDateString()===fe.date.toDateString(),dt=ue.endDate?.toDateString()===fe.date.toDateString(),ot=ue.startDate&&ue.endDate&&fe.date>=ue.startDate&&fe.date<=ue.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:fe.isCurrentMonth?Ue||dt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ue?f.accent:dt?"#7C3AED":ot?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:$e&&!Ue&&!dt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{J==="start"?(nt("startDate",fe.date),ue.endDate&&fe.date>ue.endDate&&nt("endDate",fe.date),H("end")):(nt("endDate",fe.date),ue.startDate&&fe.date<ue.startDate&&nt("startDate",fe.date),H(null));},children:fe.day},Ve)})})()})]})]})]})})]}),Xe.endDate&&jsx("span",{className:"text-xs text-red-400",children:Xe.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ue.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ee?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let U=D.currentTarget.getBoundingClientRect(),ae=Math.round((D.clientX-U.left)/U.width*100/5)*5;nt("progress",Math.max(0,Math.min(100,ae)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ue.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>R(!Le),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Le?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:Le&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ue.effortMinutes?i2(ue.effortMinutes):"",onChange:D=>{let U=l2(D.target.value);nt("effortMinutes",U);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ue.parentId||"",onChange:D=>nt("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(D=>D.id!==a?.id).map(D=>jsx("option",{value:D.id,children:D.name},D.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ue.location||"",onChange:D=>nt("location",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ue.equipment||"",onChange:D=>nt("equipment",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||m.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",l==="create"?q.length>0&&`(${q.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsx(lo,{cardId:"pending",attachments:q.map((D,U)=>({id:`pending-${U}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>ye(U=>[...U,...D]),onDelete:D=>{let U=parseInt(D.replace("pending-",""),10);ye(ae=>ae.filter((Ne,z)=>z!==U));},maxSizeMB:10,maxFiles:20}):jsx(lo,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&q.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[q.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ue.isMilestone,onChange:D=>nt("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ue.dependencies&&ue.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ue.dependencies.map(D=>{let U=r.find(ae=>ae.id===D);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[U?.name||D.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ae=(ue.dependencies||[]).filter(Ne=>Ne!==D);nt("dependencies",ae);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{type:"button",onClick:()=>{O(!_e),le("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:_e&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(false),le("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsx("input",{type:"text",value:ee,onChange:D=>le(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>ee===""||D.name.toLowerCase().includes(ee.toLowerCase())).map(D=>{let U=ue.dependencies?.includes(D.id);return jsxs("button",{type:"button",onClick:()=>{let ae=ue.dependencies||[],Ne;U?Ne=ae.filter(z=>z!==D.id):Ne=[...ae,D.id],nt("dependencies",Ne);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:U?`${f.accent}10`:"transparent"},onMouseEnter:ae=>{U||(ae.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ae=>{ae.currentTarget.style.backgroundColor=U?`${f.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:U?f.accent:"transparent",borderColor:U?f.accent:f.borderLight},children:U&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:D.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:Ee?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=f.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:D=>!n&&(D.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:D=>!n&&(D.currentTarget.style.filter="brightness(1)"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Im=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
368
+ Task dependencies must flow in one direction only.`);return}let j=X=>X.map(he=>{if(he.id===B){let Me=he.dependencies||[];if(!Me.includes(P.id))return {...he,dependencies:[...Me,P.id]}}return he.subtasks?{...he,subtasks:j(he.subtasks)}:he});Ar.current+=1,N(X=>j(X)),Ce?.(P.id,B);},[Ce,Qc]),eu=useCallback((P,B)=>{let j=X=>X.map(he=>{if(he.id===P&&he.dependencies){let Me=he.dependencies.filter(Ct=>Ct!==B);return {...he,dependencies:Me}}return he.subtasks?{...he,subtasks:j(he.subtasks)}:he});Ar.current+=1,N(X=>j(X)),we?.(P,B);},[we]),{startDate:yn,endDate:gl}=useMemo(()=>{let P=Z.filter(Me=>Me.startDate&&Me.endDate);if(P.length===0){let Me=new Date,Ct=new Date(Me);Ct.setDate(Ct.getDate()-30);let st=new Date(Me);return st.setDate(st.getDate()+60),{startDate:Ct,endDate:st}}let B=P.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),j=new Date(Math.min(...B.map(Me=>Me.getTime()))),X=new Date(Math.max(...B.map(Me=>Me.getTime()))),he=et==="day"?7:et==="week"?14:30;return j.setDate(j.getDate()-he),X.setDate(X.getDate()+he),{startDate:j,endDate:X}},[Z,et]);useEffect(()=>{Ft.current?.(yn,gl);},[yn,gl]);let Cf=useCallback(async()=>{if(!Ba.current||!Ut.current||!_t.current)return;await new Promise(Xo=>setTimeout(Xo,200));let P=Ba.current,B=Ut.current,j=sa.current||B.querySelector(".gantt-grid-scroll"),X=_t.current,he=j?.scrollTop||0,Me=j?.scrollLeft||0,Ct=X.scrollTop,st=X.scrollLeft,ka=P.style.overflow,Zt=P.style.height,fa=j?.style.overflow||"",lr=X.style.overflow,Sr=B.style.overflow,Eo=P.style.width,vn=X.style.width;try{let Xo=j?.querySelector(".gantt-taskgrid-content"),ro=X.querySelector("svg"),hl=ro?.getAttribute("height")?parseInt(ro.getAttribute("height"),10):ro?.getBoundingClientRect().height||0,wn=Xo?.scrollHeight||j?.scrollHeight||600,js=Math.max(hl,X.scrollHeight),ts=ro?.getAttribute("width")?parseInt(ro.getAttribute("width"),10):ro?.getBoundingClientRect().width||X.scrollWidth,Pf=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,yl=Math.max(wn,js,hl),ru=Pf+yl+50,ou=(j?.offsetWidth||B.offsetWidth||300)+ts+10;j&&(j.scrollTop=0,j.scrollLeft=0),X.scrollTop=0,X.scrollLeft=0,P.style.overflow="visible",P.style.height=`${ru}px`,P.style.width=`${ou}px`,B.style.overflow="visible",j&&(j.style.overflow="visible",j.style.height=`${yl+50}px`),X.style.overflow="visible",X.style.height=`${yl+50}px`,X.style.width=`${ts+10}px`,await new Promise(_s=>setTimeout(_s,150));let Af=await toPng(P,{backgroundColor:Dt.bgPrimary,pixelRatio:2,width:ou,height:ru,skipFonts:!1,filter:_s=>{if(!(_s instanceof Element))return !0;let nu=window.getComputedStyle(_s),su=parseInt(nu.zIndex,10);return !(!isNaN(su)&&su>=50||nu.position==="fixed")}}),xl=document.createElement("a");xl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,xl.href=Af,xl.click();}finally{P.style.overflow=ka,P.style.height=Zt,P.style.width=Eo,B.style.overflow=Sr,j&&(j.style.overflow=fa,j.style.height="",j.scrollTop=he,j.scrollLeft=Me),X.style.overflow=lr,X.style.height="",X.style.width=vn,X.scrollTop=Ct,X.scrollLeft=st;}p?.("png");},[Dt,p]),Tf=useCallback(async()=>{await Se.exportToPDF(Z),p?.("pdf");},[Z,p]),fl=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d});fl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d};let Nf=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),p?.("excel");return}let P=new Date,B=he=>String(he).padStart(2,"0"),j=`${P.getFullYear()}-${B(P.getMonth()+1)}-${B(P.getDate())}_${B(P.getHours())}${B(P.getMinutes())}`,X=d?d.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(Z,`${X}_${j}.xlsx`,fl.current),p?.("excel");},[Z,d,p,a.onExportExcel]),Df=useCallback(()=>{let P=Se.exportToCSV(Z),B=new Blob([P],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(B),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href),p?.("csv");},[Z,p]),Sf=useCallback(()=>{let P=Se.exportToJSON(Z),B=new Blob([P],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(B),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href),p?.("json");},[Z,p]),Ef=useCallback(()=>{Se.exportToMSProject(Z,"Gantt Project","project.xml"),p?.("msproject");},[Z,p]),Mf=P=>{P.preventDefault(),St(true);},xn=useRef(false),[bl,tu]=useState(false),es=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=_t.current,B=Ut.current?.querySelector(".gantt-grid-scroll");if(!P||!B)return;let j=()=>{if(xn.current)return;xn.current=true;let st=P.scrollTop;Qe(st),B.scrollTop=st,requestAnimationFrame(()=>{xn.current=false;});},X=()=>{if(xn.current)return;xn.current=true;let st=B.scrollTop;Qe(st),P.scrollTop=st,requestAnimationFrame(()=>{xn.current=false;});},he=st=>{if(ut&&B){let Zt=B.parentElement?.getBoundingClientRect()?.left||0,fa=st.clientX-Zt,lr=200,Sr=Ke+yt,Eo=window.innerWidth*na,vn=Math.max(Sr,Eo);fa>=lr&&fa<=vn&&At(fa);}if(bl&&P){let ka=st.clientX-es.current.x,Zt=st.clientY-es.current.y;P.scrollLeft=es.current.scrollLeft-ka,P.scrollTop=es.current.scrollTop-Zt;}},Me=()=>{St(false),tu(false);},Ct=st=>{if(st.button!==0)return;let ka=st.target;ka.closest("[data-task-bar]")||ka.closest("[data-dependency-line]")||ka.closest("button")||ka.closest('[role="button"]')||ka.tagName==="rect"&&ka.getAttribute("data-clickable")==="true"||(tu(true),es.current={x:st.clientX,y:st.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},st.preventDefault());};return P.addEventListener("scroll",j),B.addEventListener("scroll",X),P.addEventListener("mousedown",Ct),document.addEventListener("mousemove",he),document.addEventListener("mouseup",Me),()=>{P.removeEventListener("scroll",j),B.removeEventListener("scroll",X),P.removeEventListener("mousedown",Ct),document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Me);}},[ut,bl,Ke]);let au=useRef(false),Ff=useRef(null);return useLayoutEffect(()=>{if(au.current||Z.length===0||!_t.current)return;au.current=true,Ff.current=yn;let P=_t.current,B=new Date,j=et==="day"?60:et==="week"?20:8,X=(B.getTime()-yn.getTime())/(1e3*60*60*24),he=P.clientWidth,Ct=X*j*U-he/2;X>=0&&he>0&&(P.scrollLeft=Math.max(0,Ct));},[Z.length,yn,et,U]),jsx(In.Provider,{value:ke,children:jsx(Tl.Provider,{value:mr,children:jsxs("div",{ref:Ba,className:"flex flex-col h-full w-full",style:{backgroundColor:Dt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Dt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Dt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Ti,{theme:Dt,timeScale:et,onTimeScaleChange:Ee,zoom:U,onZoomChange:ae,currentTheme:ze,onThemeChange:ve,rowDensity:V,onRowDensityChange:D,showThemeSelector:c,showCreateTaskButton:S&&xe?.canCreateTask!==false&&!xe?.canCreateSubtaskOnly,createTaskLabel:E,onCreateTask:k,taskFilter:lt,onTaskFilterChange:ne,hideCompleted:pe,onHideCompletedChange:$,toolbarRightContent:L,wbsLevel:Ne,onWbsLevelChange:F,maxWbsDepth:Jt,viewMode:fe,onViewModeChange:Ve,projectForecast:Y,onExportPNG:i?Cf:void 0,onExportPDF:i?Tf:void 0,onExportExcel:i?Nf:void 0,onExportCSV:i?Df:void 0,onExportJSON:i?Sf:void 0,onExportMSProject:i?Ef:void 0,showCriticalPath:Ue,onShowCriticalPathChange:$t,showDependencies:ot,onShowDependenciesChange:Et,highlightWeekends:mt,onHighlightWeekendsChange:Mt,showBaseline:$e,onShowBaselineChange:P=>{P&&fe!=="oracle"&&Ve("oracle"),!P&&fe==="oracle"&&Ve("execution");},onCopySnapshotLink:kt,hasDependencies:Do})}),jsxs("div",{ref:Ut,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:sa,className:"gantt-grid-scroll flex-shrink-0",style:{width:jt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Si,{tasks:Xc,theme:Dt,rowHeight:Gs,availableUsers:m,templates:No,showCriticalPath:Ue,onTaskClick:G,onTaskDblClick:Jc,onTaskContextMenu:Le,onTaskToggle:uf,scrollTop:De,columns:tt,onToggleColumn:df,onColumnResize:cf,onTaskUpdate:So,onTaskIndent:pf,onTaskOutdent:mf,onTaskMove:ff,onMultiTaskDelete:pl,onTaskDuplicate:bf,onTaskCreate:hf,onTaskRename:yf,onCreateSubtask:ml,onOpenTaskModal:G?P=>G(P):void 0,onDeleteRequest:(P,B)=>I({taskId:P,taskName:B}),onTaskReparent:gf,scrollContainerRef:sa})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Dt.border,zIndex:15},onMouseDown:Mf}),jsx("div",{ref:_t,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:bl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Bi,{tasks:Xc,theme:Dt,rowHeight:Gs,timeScale:et,startDate:yn,endDate:gl,zoom:U,locale:w,templates:No,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:G,onTaskDblClick:Jc,onTaskContextMenu:wf,onTaskDateChange:vf,onTaskProgressDrag:xf,onDependencyCreate:Zc,onDependencyDelete:eu,showBaseline:$e,showCriticalPath:Ue,showDependencies:ot,highlightWeekends:mt,canEditTask:xe?.canEditTask})})]}),Qt.task&&jsx(Rn,{isOpen:Qt.isOpen,x:Qt.x,y:Qt.y,theme:Dt,onClose:()=>oa({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Qt.task;if(!P)return [];let B=Se.findTaskById(Z,P.id)||P,j=B.subtasks&&B.subtasks.length>0,X=xe?.canCreateTask!==false,he=xe?.canDeleteTask!==false;if(j){let Zt=[],fa=xe?.canDuplicateTask!==false;return X&&Zt.push({id:"addSubtask",label:ke.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{O?O(B):ml(B.id);}}),fa&&Zt.push({id:"duplicate",label:ke.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):N(lr=>ws(lr,[B.id]).tasks),oa({isOpen:false,x:0,y:0,task:null});}}),he&&(Zt.length>0&&Zt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Zt.push({id:"delete",label:ke.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:B.id,taskName:B.name});}})),Zt}let Me=xe?.canUpdateTask!==false,Ct=xe?.canDuplicateTask!==false,st=[];return Me&&st.push({id:"edit",label:ke.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{_e?_e(B):Oe(B);}}),X&&st.push({id:"addSubtask",label:ke.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{O?O(B):ml(B.id);}}),st.length>0&&Me&&st.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Me&&(st.push({id:"markIncomplete",label:ke.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{ee?ee(B):So(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"}),st.push({id:"setInProgress",label:ke.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{le?le(B):So(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"}),st.push({id:"markComplete",label:ke.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{So(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"})),(Ct||Me&&B.startDate&&B.endDate)&&st.length>0&&st.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ct&&st.push({id:"duplicate",label:ke.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):N(Zt=>ws(Zt,[B.id]).tasks),oa({isOpen:false,x:0,y:0,task:null});}}),Me&&B.startDate&&B.endDate&&st.push({id:"split",label:ke.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{let Zt=B.startDate.getTime(),fa=B.endDate.getTime(),lr=Zt+(fa-Zt)/2,Sr=new Date(lr);kf(B,Sr);}}),he&&(st.length>0&&st.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),st.push({id:"delete",label:ke.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:B.id,taskName:B.name});}})),st})()}),jsx(yo,{task:Q,isOpen:!!Q,onClose:()=>Oe(null),onTaskUpdate:P=>{Q&&(So(Q.id,P),Oe(null));},theme:ze==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsx(AnimatePresence,{children:Pe&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>I(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Dt.bgSecondary,border:`1px solid ${Dt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Dt.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:Dt.textPrimary,fontFamily:"Inter, sans-serif"},children:[ke.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Dt.textPrimary},children:['"',Pe.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Dt.bgPrimary,borderTop:`1px solid ${Dt.border}`},children:[jsx("button",{onClick:()=>I(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Dt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{pl([Pe.taskId]),I(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsx(Oi,{tasks:Z,theme:Dt,config:b,onTasksUpdate:N,onTaskUpdate:So,onTaskCreate:P=>{N(B=>[...B,P]);},onTaskDelete:P=>{pl([P]);},onDependencyCreate:(P,B)=>{let j=Se.findTaskById(Z,P);j&&Zc(j,B);},onDependencyDelete:eu})]})})})});function i2(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function l2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var $d=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Od=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Lm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...$d,...i.filter(D=>!$d.some(U=>U.id===D.id))],f=ft[c]||ft.dark,[b,w]=useState(false),[C,S]=useState(false),[E,k]=useState(false),[v,A]=useState(false),[L,M]=useState({top:0,left:0}),[J,H]=useState(null),[Y,T]=useState(new Date),[G,te]=useState({top:0,left:0}),[Le,R]=useState(false),[q,ye]=useState([]),[_e,O]=useState(false),[ee,le]=useState(""),Ce=useRef(null),we=useRef(null),Be=useRef(null),He=useRef(null),at=useRef(null),[ue,je]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Xe,xe]=useState({});useEffect(()=>{a?(je({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(je({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),ye([]));},[a,e,x]),useEffect(()=>{let D=U=>{Ce.current&&!Ce.current.contains(U.target)&&w(false),we.current&&!we.current.contains(U.target)&&S(false),Be.current&&!Be.current.contains(U.target)&&k(false),He.current&&!He.current.contains(U.target)&&A(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let kt=()=>{let D={};return ue.name.trim()||(D.name="El nombre es requerido"),ue.startDate&&ue.endDate&&ue.startDate>ue.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),xe(D),Object.keys(D).length===0},xt=async D=>{if(D.preventDefault(),!!kt())try{let U=l==="create"&&q.length>0?{...ue,pendingFiles:q}:ue;await s(U),ye([]),t();}catch(U){console.error("Error submitting task:",U);}},nt=(D,U)=>{je(ae=>{let Ne={...ae,[D]:U};if(D==="status"){let z=U;z==="todo"?Ne.progress=0:z==="in-progress"?(ae.progress===0||ae.progress===100)&&(Ne.progress=50):z==="completed"||z==="closed"?Ne.progress=100:(z==="in-review"||z==="review")&&(Ne.progress=75);}if(D==="progress"){let z=typeof U=="number"?U:parseInt(U,10);z===100&&ae.status!=="completed"?Ne.status="completed":z>0&&z<100&&ae.status==="todo"?Ne.status="in-progress":z===0&&ae.status!=="todo"&&(Ne.status="todo");}return Ne}),Xe[D]&&xe(ae=>{let Ne={...ae};return delete Ne[D],Ne});},ze=h.find(D=>D.id===ue.status)??$d[0],ct=Od.find(D=>D.id===ue.priority)??Od[1],et=an.find(D=>D.value===ue.color)??an[0],Ee=c==="dark",V={backgroundColor:Ee?"#1d1f27":f.bgSecondary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Ee?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.border}`,boxShadow:Ee?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:D=>D.stopPropagation(),children:jsxs("form",{onSubmit:xt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ue.name,onChange:D=>nt("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Xe.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Xe.name]}),jsx("textarea",{value:ue.description||"",onChange:D=>nt("description",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Ce,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:ze.color,backgroundColor:`${ze.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:ze.color}}),jsx("span",{style:{color:ze.color},children:ze.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:ze.color}})]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("status",D.id),w(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ue.status===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxs("div",{ref:we,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&S(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsx("span",{children:ct.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Od.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("priority",D.id),S(false);},children:[jsx("span",{children:D.icon}),D.label,ue.priority===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!E),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[ue.assignees&&ue.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ue.assignees.slice(0,3).map((D,U)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},U))}),ue.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",ue.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let U=ue.assignees?.some(ae=>ae.name===D.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ae=U?(ue.assignees||[]).filter(Ne=>Ne.name!==D.name):[...ue.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Ne=>Ne[0]).join("").toUpperCase().slice(0,2),color:f.accent}];nt("assignees",ae);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:D.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:D.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:U&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxs("div",{ref:He,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(v)A(false);else {if(He.current){let D=He.current.getBoundingClientRect(),U=window.innerHeight,ae=120,z=U-D.bottom<ae?D.top-ae-8:D.bottom+8;M({top:z,left:D.left});}A(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ue.color}}),jsx("span",{children:et.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:v&&jsxs(ea,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>A(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${L.top}px`,left:`${L.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:an.slice(0,18).map(D=>{let U=ue.color===D.value;return jsx("button",{type:"button",onClick:ae=>{ae.preventDefault(),ae.stopPropagation(),nt("color",D.value),A(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:U?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),p.length>0||d?jsx(Ao,{selectedTags:ue.tags||[],availableTags:p,onChange:D=>nt("tags",D),onCreateTag:d,theme:f,disabled:n}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Ee?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${Ee?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxs("div",{ref:at,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ue.isMilestone)if(J==="start")H(null);else {if(at.current){let D=at.current.getBoundingClientRect();te({top:D.bottom+8,left:Math.max(16,D.left-40)});}H("start"),T(ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:n||ue.isMilestone,children:ue.startDate?ue.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ue.isMilestone)if(J==="end")H(null);else {if(at.current){let D=at.current.getBoundingClientRect();te({top:D.bottom+8,left:Math.max(16,D.left-40)});}H("end"),T(ue.endDate||ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:n||ue.isMilestone,children:ue.endDate?ue.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:J&&jsxs(ea,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${G.top}px`,left:`${G.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":f.bgPrimary,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Ee?"#262626":f.border}`},children:[(()=>{let D=new Date,U=new Date(D);U.setDate(D.getDate()+1);let ae=new Date(D);ae.setDate(D.getDate()+7);let Ne=new Date(D);return Ne.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:U},{label:"Pr\xF3xima semana",date:ae},{label:"2 semanas",date:Ne}].map((oe,Ge)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:fe=>fe.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{J==="start"?(nt("startDate",oe.date),(!ue.endDate||oe.date>ue.endDate)&&nt("endDate",oe.date),H("end")):(nt("endDate",oe.date),(!ue.startDate||oe.date<ue.startDate)&&nt("startDate",oe.date),H(null));},children:oe.label},Ge))})(),jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("startDate",void 0),nt("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>T(new Date(Y.getFullYear(),Y.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:Y.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>T(new Date(Y.getFullYear(),Y.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,U)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},U))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=Y.getFullYear(),U=Y.getMonth(),ae=new Date(D,U,1).getDay(),Ne=new Date(D,U+1,0).getDate(),z=new Date,oe=[];for(let fe=ae-1;fe>=0;fe--)oe.push({day:new Date(D,U,-fe).getDate(),date:new Date(D,U-1,new Date(D,U,-fe).getDate()),isCurrentMonth:false});for(let fe=1;fe<=Ne;fe++)oe.push({day:fe,date:new Date(D,U,fe),isCurrentMonth:true});let Ge=42-oe.length;for(let fe=1;fe<=Ge;fe++)oe.push({day:fe,date:new Date(D,U+1,fe),isCurrentMonth:false});return oe.map((fe,Ve)=>{let $e=fe.date.toDateString()===z.toDateString(),Ue=ue.startDate?.toDateString()===fe.date.toDateString(),dt=ue.endDate?.toDateString()===fe.date.toDateString(),ot=ue.startDate&&ue.endDate&&fe.date>=ue.startDate&&fe.date<=ue.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:fe.isCurrentMonth?Ue||dt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ue?f.accent:dt?"#7C3AED":ot?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:$e&&!Ue&&!dt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{J==="start"?(nt("startDate",fe.date),ue.endDate&&fe.date>ue.endDate&&nt("endDate",fe.date),H("end")):(nt("endDate",fe.date),ue.startDate&&fe.date<ue.startDate&&nt("startDate",fe.date),H(null));},children:fe.day},Ve)})})()})]})]})]})})]}),Xe.endDate&&jsx("span",{className:"text-xs text-red-400",children:Xe.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ue.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ee?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let U=D.currentTarget.getBoundingClientRect(),ae=Math.round((D.clientX-U.left)/U.width*100/5)*5;nt("progress",Math.max(0,Math.min(100,ae)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ue.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>R(!Le),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Le?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:Le&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ue.effortMinutes?i2(ue.effortMinutes):"",onChange:D=>{let U=l2(D.target.value);nt("effortMinutes",U);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ue.parentId||"",onChange:D=>nt("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(D=>D.id!==a?.id).map(D=>jsx("option",{value:D.id,children:D.name},D.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ue.location||"",onChange:D=>nt("location",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ue.equipment||"",onChange:D=>nt("equipment",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||m.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",l==="create"?q.length>0&&`(${q.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsx(lo,{cardId:"pending",attachments:q.map((D,U)=>({id:`pending-${U}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>ye(U=>[...U,...D]),onDelete:D=>{let U=parseInt(D.replace("pending-",""),10);ye(ae=>ae.filter((Ne,z)=>z!==U));},maxSizeMB:10,maxFiles:20}):jsx(lo,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&q.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[q.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ue.isMilestone,onChange:D=>nt("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ue.dependencies&&ue.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ue.dependencies.map(D=>{let U=r.find(ae=>ae.id===D);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[U?.name||D.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ae=(ue.dependencies||[]).filter(Ne=>Ne!==D);nt("dependencies",ae);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{type:"button",onClick:()=>{O(!_e),le("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:_e&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(false),le("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsx("input",{type:"text",value:ee,onChange:D=>le(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>ee===""||D.name.toLowerCase().includes(ee.toLowerCase())).map(D=>{let U=ue.dependencies?.includes(D.id);return jsxs("button",{type:"button",onClick:()=>{let ae=ue.dependencies||[],Ne;U?Ne=ae.filter(z=>z!==D.id):Ne=[...ae,D.id],nt("dependencies",Ne);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:U?`${f.accent}10`:"transparent"},onMouseEnter:ae=>{U||(ae.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ae=>{ae.currentTarget.style.backgroundColor=U?`${f.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:U?f.accent:"transparent",borderColor:U?f.accent:f.borderLight},children:U&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:D.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:Ee?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=f.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:D=>!n&&(D.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:D=>!n&&(D.currentTarget.style.filter="brightness(1)"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Im=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
369
369
 
370
370
  AVAILABLE COMMANDS:
371
371
  1. move_task - Move a task to a different date