{"version":3,"file":"tour-context.cjs","sources":["../../../components/tour/tour-context.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\nimport type {\n  TourActions,\n  TourStatus,\n  TourStep,\n  TourTransition\n} from './types';\n\nexport interface TourContextValue {\n  steps: TourStep[];\n  index: number;\n  step: TourStep | null;\n  open: boolean;\n  status: TourStatus;\n  anchor: Element | null;\n  spotlightElement: Element | null;\n  popoverOpen: boolean;\n  disableOverlay: boolean;\n  transition: TourTransition;\n  revealed: boolean;\n  actions: TourActions;\n}\n\nexport const TourContext = createContext<TourContextValue | null>(null);\n\nexport function useTourContext(part: string): TourContextValue {\n  const context = useContext(TourContext);\n  if (!context) {\n    throw new Error(`${part} must be used within <Tour>`);\n  }\n  return context;\n}\n\nexport interface UseTourReturn {\n  open: boolean;\n  status: TourStatus;\n  index: number;\n  totalSteps: number;\n  isFirstStep: boolean;\n  isLastStep: boolean;\n  /** Active step, or null while the tour is closed. */\n  step: TourStep | null;\n  actions: TourActions;\n}\n\n/**\n * Access the active tour from anywhere inside `<Tour>`, e.g. to build fully\n * custom popover content or to drive the tour from the spotlighted UI.\n */\nexport function useTour(): UseTourReturn {\n  const { steps, index, step, status, actions, open } =\n    useTourContext('useTour');\n  return {\n    open,\n    status,\n    actions,\n    step,\n    index,\n    totalSteps: steps.length,\n    isFirstStep: index <= 0,\n    isLastStep: index >= steps.length - 1\n  };\n}\n"],"names":[],"mappings":";;;;;;AA2BM;AACJ;;AAEE;;AAEF;AACF;AAcA;;;AAGG;;AAED;;;;;;;;;AAUE;;AAEJ;;;;"}