/**
 * Utility exports for web components
 * @countermeasure/web-components/utils
 */

// Date utilities
export {
  buildDayGrid,
  DAYS_MON,
  DAYS_SUN,
  isBetween,
  isDateDisabled,
  isSameDay,
  MONTHS,
  stripTime,
  type WeekStart,
} from './date'

// Selection utilities
export { toggleSelectAll, toggleSelection } from './selection'

// Validation utilities
export {
  createValidator,
  validateEmail,
  validateMaxLength,
  validateMinLength,
  validatePattern,
  validateRequired,
  validateUrl,
  type ValidationResult,
  type ValidationRule,
} from './validation'

// Error classes
export { ComponentError, ConfigError, NetworkError, ValidationError } from './errors'

// Sorting utilities
export {
  compareValues,
  cycleSortDirection,
  sortRows,
  type SortDirection,
  type SortState,
} from './sorting'

// Sanitization utilities
export {
  escapeHtml,
  sanitizeHtml,
  setSafeHtml,
  setSafeIconHtml,
  type SanitizeHtmlOptions,
} from './sanitize'

// Accessibility utilities
export {
  REGISTRY_ACTION_ORDER,
  REGISTRY_SEGMENT_REGEX,
  errorMessage,
  getCheckedValues,
  isValidRegistryPattern,
  sortRegistryActions,
  type RegistryRule,
} from './registry'

export {
  // Focus trap
  createFocusTrap,
  getFocusableElements,
  type FocusTrap,

  // Live regions
  announce,
  createLiveRegion,
  type LiveRegion,

  // Roving tabindex
  createRovingTabindex,
  type RovingTabindex,

  // ARIA linking
  linkDescribedBy,
  linkLabelledBy,
  linkControls,
  linkOwns,

  // Screen reader helpers
  createSrOnlyElement,

  // Focus visible
  isFocusVisibleSupported,
  manageFocusVisible,
} from './a11y'

// Keyboard navigation utilities
export {
  // Key constants
  Keys,
  type KeyName,

  // Grid navigation
  gridNavigate,
  type GridNavOptions,
  type GridNavResult,

  // Tree navigation
  treeNavigate,
  type TreeNavOptions,
  type TreeNavResult,

  // List navigation
  listNavigate,
  type ListNavOptions,
  type ListNavResult,

  // Type-ahead
  createTypeAhead,
  type TypeAheadOptions,
  type TypeAheadController,

  // Helpers
  isPrintableKey,
  isInputElement,
  getShortcutFromEvent,
} from './keyboard'

// Touch and gesture utilities
export {
  // Swipe detection
  detectSwipe,
  type SwipeDirection,
  type SwipeOptions,
  type SwipeDetector,

  // Touch/click handling
  handleTouchOrClick,
  onPointerDown,

  // Pinch-to-zoom
  detectPinch,
  type PinchOptions,
  type PinchDetector,

  // Pan detection
  detectPan,
  type PanOptions,
  type PanDetector,

  // Long press
  detectLongPress,
  type LongPressOptions,
  type LongPressDetector,

  // Device detection
  isTouchDevice,
  isMobileViewport,
  isPortrait,
  getSafeAreaInsets,
} from './touch'
