react-wizard-engine 0.1.3 → 0.1.4
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/CHANGELOG.md +6 -0
- package/dist/chunk-5ZSA2PNS.js +76 -0
- package/dist/chunk-5ZSA2PNS.js.map +1 -0
- package/dist/chunk-XNH2LQZL.cjs +76 -0
- package/dist/chunk-XNH2LQZL.cjs.map +1 -0
- package/dist/index.cjs +388 -548
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -104
- package/dist/index.js.map +1 -1
- package/dist/shadcn/index.cjs +64 -156
- package/dist/shadcn/index.cjs.map +1 -1
- package/dist/shadcn/index.js +32 -83
- package/dist/shadcn/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/enums/wizard-event-type.enum.ts","../src/core/utils/general/last.ts","../src/core/utils/general/to-array.ts","../src/core/utils/state/get-step-id.ts","../src/core/utils/state/get-shape-id.ts","../src/core/utils/state/get-state-id.ts","../src/core/builders/build-tree-state.ts","../src/core/builders/wizard-default.const.ts","../src/core/errors/wizard.error.ts","../src/core/rules/wizard-rule.ts","../src/core/rules/wizard-active-step.rule.ts","../src/core/rules/wizard-passed-prev-categories.rule.ts","../src/core/rules/wizard-passed-prev-steps.rule.ts","../src/core/rules/wizard-shown-active-category.rule.ts","../src/core/rules/wizard-single-active-category.rule.ts","../src/core/rules/wizard-rules.ts","../src/core/state/wizard-tree.state.ts","../src/core/state/project-to-tree.ts","../src/core/builders/wizard-tree-state.builder.ts","../src/core/compose-wizard-providers.ts","../src/core/events/wizard-events.ts","../src/core/initializers/wizard-initializer.ts","../src/core/initializers/wizard-default.initializer.ts","../src/core/listeners/wizard-listener.ts","../src/core/navigation/initializer-service.ts","../src/core/navigation/typed-emitter.ts","../src/core/navigation/wizard-navigation.ts","../src/core/navigation/navigation-service.ts","../src/core/navigation/state-service.ts","../src/core/strategies/progress/wizard-progress.strategy.ts","../src/core/strategies/progress/wizard-active-progress.strategy.ts","../src/core/strategies/scroll/wizard-scroll.strategy.ts","../src/core/strategies/scroll/wizard-smooth-scroll.strategy.ts","../src/core/strategies/visibility/wizard-visibility.strategy.ts","../src/core/strategies/visibility/wizard-default-visibility.strategy.ts","../src/core/strategies/visibility/wizard-last-active-visibility.strategy.ts","../src/core/wizard-default.config.ts","../src/core/wizard-config.ts","../src/core/wizard-log.ts","../src/core/wizard-store.ts","../src/core/wizard-engine.ts","../src/enums/wizard-category-direction.enum.ts","../src/react/components-provider.tsx","../src/react/use-wizard.ts","../src/react/context.ts","../src/react/components/wizard-action-button.tsx","../src/react/components/wizard-back.tsx","../src/react/components/wizard-category.tsx","../src/utils/cn.ts","../src/react/components/wizard-stepper-dot.tsx","../src/react/components/wizard-stepper.tsx","../src/react/components/wizard-header.tsx","../src/react/components/wizard-next.tsx","../src/react/components/wizard-rail.tsx","../src/react/hooks/use-wizard-categories-view.ts","../src/react/components/wizard-step.tsx","../src/react/provider.tsx","../src/react/use-wizard-engine-ref.ts","../src/react/use-wizard-event.ts","../src/react/use-wizard-step.ts"],"sourcesContent":["export enum WizardEventType {\n\tComplete = 'complete',\n\tExit = 'exit',\n\tNavigationCancelled = 'navigation_cancelled',\n\tNavigationEnd = 'navigation_end',\n\tNavigationError = 'navigation_error',\n\tNavigationIgnored = 'navigation_ignored',\n\tNavigationStart = 'navigation_start',\n\n\tResolveEnd = 'resolve_end',\n\tResolveStart = 'resolve_start',\n\n\tScrollEnd = 'scroll_end',\n\tScrollStart = 'scroll_start',\n\n\tStepHide = 'step_hide',\n\tStepShow = 'step_show',\n}\n","export const last = <T>(arr: T[]): T | undefined => arr[arr.length - 1];\n","export const toArray = <T>(arr: T | T[]): T[] => (Array.isArray(arr) ? arr : [arr]);\n","import type { IWizardEntityState, WizardEntityStateId } from '../../../interfaces/wizard-entity-state.interface';\nimport type { IWizardStepState } from '../../state/wizard-step.state';\n\nexport const getStepId = (stepState: IWizardStepState<string, string>): string => {\n\tconst branchesId = stepState.branches.join(',');\n\n\treturn `${stepState.htmlIndex}:${branchesId}.${stepState.categoryId}.${stepState.id}`;\n};\n\n/**\n * `+isShow, +isCompleted, +isSkipped, +isActive` | for example `1001`\n */\nexport const getStepStateId = (stepState: IWizardEntityState): WizardEntityStateId => {\n\treturn `${+stepState.isShow}${+stepState.isCompleted}${+stepState.isSkipped}${+stepState.isActive}` as WizardEntityStateId;\n};\n","import type { IWizardState } from '../../../interfaces/wizard-step-state-data.interface';\n\nimport { getStepId } from './get-step-id';\n\nexport const getShapeId = (state: IWizardState<string, string>, prefix: number | string = ''): string => {\n\tconst id = state.map(getStepId).join('|');\n\n\treturn prefix !== '' && prefix !== undefined ? `@${prefix}@${id}` : id;\n};\n","import type { IWizardState } from '../../../interfaces/wizard-step-state-data.interface';\n\nimport { getStepStateId } from './get-step-id';\n\nexport const getStateId = (state: IWizardState<string, string>, prefix = ''): string => {\n\tconst id = state.map(getStepStateId).join('|');\n\n\treturn prefix ? `@${prefix}@${id}` : id;\n};\n","import type { IWizardBranchState, IWizardCategoryState, IWizardStepState, IWizardTreeState } from '../state';\n\nimport { getStateId, last } from '../utils';\n\n/**\n * Pure factory for `IWizardBranchState`.\n */\nexport function buildWizardBranchState<Step extends string, Category extends string, Branch extends string = string>(\n\tid: Branch,\n\tcategories: ReadonlyArray<IWizardCategoryState<Step, Category, Branch>>\n): IWizardBranchState<Step, Category, Branch> {\n\tconst shownCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\tconst activeCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\tconst completedCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\tconst skippedCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\tconst passedCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\n\tfor (const category of categories) {\n\t\tif (category.isActive) activeCategories.push(category);\n\t\tif (category.isShow) shownCategories.push(category);\n\t\tif (category.isCompleted) completedCategories.push(category);\n\t\tif (category.isSkipped) skippedCategories.push(category);\n\t\tif (category.isPassed) passedCategories.push(category);\n\t}\n\n\tconst activeCategory = (activeCategories[0] ?? shownCategories[0]) as IWizardCategoryState<Step, Category, Branch>;\n\n\tconst getShownCategoryIndex = (category: IWizardCategoryState<Step, Category, Branch>): number =>\n\t\tshownCategories.indexOf(category);\n\n\tconst activeCategoryIndex = getShownCategoryIndex(activeCategory);\n\n\tconst firstCategory = shownCategories[0] as IWizardCategoryState<Step, Category, Branch>;\n\tconst lastCategory = last(shownCategories) as IWizardCategoryState<Step, Category, Branch>;\n\tconst prevCategory = activeCategoryIndex > 0 ? (shownCategories[activeCategoryIndex - 1] ?? null) : null;\n\tconst nextCategory = activeCategoryIndex >= 0 ? (shownCategories[activeCategoryIndex + 1] ?? null) : null;\n\n\tconst getShownCategories = (\n\t\tfromIndex: number,\n\t\ttoIndex: number\n\t): Array<IWizardCategoryState<Step, Category, Branch>> => shownCategories.slice(fromIndex, toIndex + 1);\n\n\treturn {\n\t\tactiveCategories,\n\t\tactiveCategory,\n\t\tactiveCategoryIndex,\n\t\tcategories: [...categories],\n\t\tcompletedCategories,\n\t\tfirstCategory,\n\t\tgetShownCategories,\n\t\tgetShownCategoryIndex,\n\t\tid,\n\t\tlastCategory,\n\t\tnextCategory,\n\t\tpassedCategories,\n\t\tprevCategory,\n\t\tshownCategories,\n\t\tskippedCategories,\n\t};\n}\n\n/**\n * Pure factory for `IWizardCategoryState`. Groups steps into shown/active/completed/skipped/passed\n * buckets, then derives all relational fields.\n */\nexport function buildWizardCategoryState<Step extends string, Category extends string, Branch extends string = string>(\n\tid: Category,\n\thtmlIndex: number,\n\tsteps: ReadonlyArray<IWizardStepState<Step, Category, Branch>>\n): IWizardCategoryState<Step, Category, Branch> {\n\tconst branches = steps[0]?.branches ?? [];\n\n\tconst shownSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\tconst activeSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\tconst completedSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\tconst skippedSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\tconst passedSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\n\tfor (const step of steps) {\n\t\tif (step.isActive) activeSteps.push(step);\n\t\tif (step.isShow) shownSteps.push(step);\n\t\tif (step.isSkipped) skippedSteps.push(step);\n\t\tif (step.isCompleted) completedSteps.push(step);\n\t\tif (step.isSkipped || step.isCompleted) passedSteps.push(step);\n\t}\n\n\tconst isActive = activeSteps.length > 0;\n\tconst isShow = shownSteps.length > 0;\n\tconst skippedAt = shownSteps.findIndex(step => step.isSkipped);\n\tconst isSkipped = skippedAt !== -1;\n\tconst completedShownSteps = shownSteps.filter(step => step.isCompleted || step.isSkipped);\n\tconst isCompleted = completedShownSteps.length === shownSteps.length && shownSteps.length > 0;\n\tconst isPassed = isCompleted || isSkipped;\n\n\tconst lastActiveStep = last(activeSteps) as IWizardStepState<Step, Category, Branch>;\n\tconst activeStepIndex = lastActiveStep ? shownSteps.indexOf(lastActiveStep) : -1;\n\n\tconst firstStep = shownSteps[0] as IWizardStepState<Step, Category, Branch>;\n\tconst lastStep = last(shownSteps) as IWizardStepState<Step, Category, Branch>;\n\tconst firstActiveStep = activeSteps[0] as IWizardStepState<Step, Category, Branch>;\n\tconst prevStep = activeStepIndex > 0 ? (shownSteps[activeStepIndex - 1] ?? null) : null;\n\tconst nextStep = activeStepIndex >= 0 ? (shownSteps[activeStepIndex + 1] ?? null) : null;\n\n\treturn {\n\t\tactiveStepIndex,\n\t\tactiveSteps,\n\t\tbranches: [...branches],\n\t\tcompletedSteps,\n\t\tfirstActiveStep,\n\t\tfirstStep,\n\t\thtmlIndex,\n\t\tid,\n\t\tisActive,\n\t\tisCompleted,\n\t\tisPassed,\n\t\tisShow,\n\t\tisSkipped,\n\t\tlastActiveStep,\n\t\tlastStep,\n\t\tnextStep,\n\t\tpassedSteps,\n\t\tprevStep,\n\t\tshownSteps,\n\t\tskippedAt,\n\t\tskippedSteps,\n\t\tsteps: [...steps],\n\t};\n}\n\n/**\n * Pure factory for `IWizardTreeState`. Builds stepMap, groups steps by category in declaration order,\n * groups categories by branch (a category may belong to multiple branches), and\n * picks the active branch.\n */\nexport function buildWizardTreeState<Step extends string, Category extends string, Branch extends string = string>(\n\tstate: ReadonlyArray<IWizardStepState<Step, Category, Branch>>,\n\tactiveBranchId?: Branch | null\n): IWizardTreeState<Step, Category, Branch> {\n\tconst stepMap = {} as Record<Step, IWizardStepState<Step, Category, Branch>>;\n\n\tconst categoryOrder: Category[] = [];\n\tconst stepsByCategory = {} as Record<Category, Array<IWizardStepState<Step, Category, Branch>>>;\n\n\tfor (const step of state) {\n\t\tstepMap[step.id] = step;\n\n\t\tif (!stepsByCategory[step.categoryId]) {\n\t\t\tcategoryOrder.push(step.categoryId);\n\t\t\tstepsByCategory[step.categoryId] = [];\n\t\t}\n\n\t\tstepsByCategory[step.categoryId].push(step);\n\t}\n\n\tconst categoryMap = {} as Record<Category, IWizardCategoryState<Step, Category, Branch>>;\n\tconst categoriesByBranch = {} as Record<Branch, Array<IWizardCategoryState<Step, Category, Branch>>>;\n\n\tfor (const [index, categoryId] of categoryOrder.entries()) {\n\t\tconst categoryState = buildWizardCategoryState<Step, Category, Branch>(\n\t\t\tcategoryId,\n\t\t\tindex,\n\t\t\tstepsByCategory[categoryId]\n\t\t);\n\t\tcategoryMap[categoryId] = categoryState;\n\n\t\tfor (const branchId of categoryState.branches) {\n\t\t\t(categoriesByBranch[branchId] ??= []).push(categoryState);\n\t\t}\n\t}\n\n\tconst branchMap = {} as Record<Branch, IWizardBranchState<Step, Category, Branch>>;\n\tconst branches: Array<IWizardBranchState<Step, Category, Branch>> = [];\n\n\tfor (const branchId of Object.keys(categoriesByBranch) as Branch[]) {\n\t\tconst branchState = buildWizardBranchState<Step, Category, Branch>(branchId, categoriesByBranch[branchId]);\n\t\tbranchMap[branchId] = branchState;\n\t\tbranches.push(branchState);\n\t}\n\n\tconst activeBranch = pickActiveBranch(branches, branchMap, activeBranchId);\n\tconst activeCategory = activeBranch.activeCategory;\n\tconst activeSteps = activeCategory.activeSteps;\n\tconst lastActiveStep = last(activeSteps) as IWizardStepState<Step, Category, Branch>;\n\n\treturn {\n\t\tactiveBranch,\n\t\tactiveCategory,\n\t\tactiveSteps,\n\t\tbranches,\n\t\tbranchMap,\n\t\tcategoryMap,\n\t\tid: getStateId(state as Array<IWizardStepState<Step, Category, Branch>>),\n\t\tlastActiveStep,\n\t\tstate: [...state],\n\t\tstepMap,\n\t};\n}\n\nfunction pickActiveBranch<Step extends string, Category extends string, Branch extends string>(\n\tbranches: ReadonlyArray<IWizardBranchState<Step, Category, Branch>>,\n\tbranchMap: Record<Branch, IWizardBranchState<Step, Category, Branch>>,\n\tactiveBranchId?: Branch | null\n): IWizardBranchState<Step, Category, Branch> {\n\tif (branches.length === 1) {\n\t\treturn branches[0]!;\n\t}\n\n\tconst activeBranches = branches.filter(branch => branch.activeCategories.length > 0);\n\n\tif (activeBranches.length === 1) {\n\t\treturn activeBranches[0]!;\n\t}\n\n\tif (activeBranchId && branchMap[activeBranchId]) {\n\t\treturn branchMap[activeBranchId];\n\t}\n\n\treturn activeBranches[0] ?? branches[0]!;\n}\n","import type { IWizardEntityState } from '../../interfaces/wizard-entity-state.interface';\n\n/**\n * Default per-step entity state.\n */\nexport const wizardDefaultState: IWizardEntityState = {\n\tisActive: false,\n\tisCompleted: false,\n\tisShow: true,\n\tisSkipped: false,\n};\n\n/**\n * Default branch id when steps don't declare branches.\n */\nexport const wizardDefaultBranch = 'main';\n","export class WizardError extends Error {\n\tpublic override readonly name: string = 'WizardError';\n\n\tconstructor(message?: string) {\n\t\tsuper(message);\n\t\tObject.setPrototypeOf(this, new.target.prototype);\n\t}\n}\n\nexport class WizardInitializationError extends WizardError {\n\tpublic override readonly name: string = 'WizardInitializationError';\n}\n\nexport class WizardNavigationError extends WizardError {\n\tpublic override readonly name: string = 'WizardNavigationError';\n}\n\nexport class WizardResolverError extends WizardError {\n\tpublic override readonly name: string = 'WizardResolverError';\n}\n","import type { IWizardTreeState } from '../state';\n\n/**\n * Base contract every wizard tree-state rule must implement.\n *\n * Rules run on every freshly built tree before it's published; any rule that\n * fails throws a `WizardError`, aborting the build. This keeps invariants\n * (single active category, no skipped-but-active step, etc.) checked centrally.\n */\nexport abstract class WizardRule {\n\tpublic abstract verify(tree: Readonly<IWizardTreeState<string, string>>): never | void;\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardActiveStepRule extends WizardRule {\n\tpublic override verify({ lastActiveStep }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tif (!lastActiveStep) {\n\t\t\tthrow new WizardError('[WizardActiveStepRule]: There are no available active step in tree state.');\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardPassedPrevCategoriesRule extends WizardRule {\n\tpublic override verify({ activeBranch, activeCategory }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tconst prevCategories = activeBranch.shownCategories.slice(0, activeBranch.activeCategoryIndex);\n\n\t\tconst hasUnpassedPrevCategories = prevCategories.some(prevCategory => !prevCategory.isPassed);\n\n\t\tif (hasUnpassedPrevCategories) {\n\t\t\tconst prevCategoryNames = prevCategories.map(prevCategory => prevCategory.id).join(',');\n\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardPassedPrevCategoriesRule]: Active category \"${activeCategory.id}\" has neither completed nor skipped prev categories. Please, skip or complete categories: \"${prevCategoryNames}\".`\n\t\t\t);\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardPassedPrevStepsRule extends WizardRule {\n\tpublic override verify({ activeCategory }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tconst prevSteps = activeCategory.shownSteps.slice(0, activeCategory.activeStepIndex);\n\t\tconst prevUnpassedSteps = prevSteps.filter(prevStep => !prevStep.isCompleted && !prevStep.isSkipped);\n\n\t\tif (prevUnpassedSteps.length) {\n\t\t\tconst prevStepNames = prevUnpassedSteps.map(prevStep => prevStep.id).join(',');\n\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardPassedPrevStepsRule]: Last active step \"${activeCategory.lastActiveStep.id}\" has not completed steps before. Please, complete or hide steps: \"${prevStepNames}\".`\n\t\t\t);\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardShownActiveCategoryRule extends WizardRule {\n\tpublic override verify({ activeCategory }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tif (!activeCategory.isShow) {\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardShownActiveCategoryRule]: Active category is hidden. Please, show category \"${activeCategory.id}\" to be able to activate it.`\n\t\t\t);\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardSingleActiveCategoryRule extends WizardRule {\n\tpublic override verify({ activeBranch }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tif (activeBranch.activeCategories.length > 1) {\n\t\t\tconst activeCategoryNames = activeBranch.activeCategories.map(c => c.id).join(',');\n\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardSingleActiveCategoryRule]: There are 2 active categories at the same time: ${activeCategoryNames}.`\n\t\t\t);\n\t\t}\n\t}\n}\n","import type { WizardRule } from './wizard-rule';\n\nimport { WizardActiveStepRule } from './wizard-active-step.rule';\nimport { WizardPassedPrevCategoriesRule } from './wizard-passed-prev-categories.rule';\nimport { WizardPassedPrevStepsRule } from './wizard-passed-prev-steps.rule';\nimport { WizardShownActiveCategoryRule } from './wizard-shown-active-category.rule';\nimport { WizardSingleActiveCategoryRule } from './wizard-single-active-category.rule';\n\n/**\n * Default rule chain run by `WizardTreeStateBuilder.validate(tree)` on every build.\n */\nexport const wizardRules: WizardRule[] = [\n\tnew WizardActiveStepRule(),\n\tnew WizardSingleActiveCategoryRule(),\n\tnew WizardShownActiveCategoryRule(),\n\tnew WizardPassedPrevStepsRule(),\n\tnew WizardPassedPrevCategoriesRule(),\n];\n","import type { IWizardState } from '../../interfaces/wizard-step-state-data.interface';\nimport type { IWizardBranchState } from './wizard-branch.state';\nimport type { IWizardCategoryState } from './wizard-category.state';\nimport type { IWizardStepState } from './wizard-step.state';\n\n/**\n * Wizard tree state subtype for the initial tree.\n */\nexport type IWizardInitTreeState<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> = IWizardTreeState<Step, Category, Branch>;\n\nexport interface IWizardTreeState<Step extends string, Category extends string, Branch extends string = string> {\n\treadonly activeBranch: IWizardBranchState<Step, Category, Branch>;\n\n\treadonly activeCategory: IWizardCategoryState<Step, Category, Branch>;\n\n\treadonly activeSteps: Array<IWizardStepState<Step, Category, Branch>>;\n\n\treadonly branches: Array<IWizardBranchState<Step, Category, Branch>>;\n\treadonly branchMap: Record<Branch, IWizardBranchState<Step, Category, Branch>>;\n\treadonly categoryMap: Record<Category, IWizardCategoryState<Step, Category, Branch>>;\n\n\treadonly id: string;\n\treadonly lastActiveStep: IWizardStepState<Step, Category, Branch>;\n\treadonly state: IWizardState<Step, Category, Branch>;\n\treadonly stepMap: Record<Step, IWizardStepState<Step, Category, Branch>>;\n}\n\n/**\n * Terminal \"complete\" tree state. See `WizardExitTreeState` for the rationale on\n * keeping this as a class.\n */\nexport class WizardCompleteTreeState<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic readonly state = 'complete' as const;\n\n\tconstructor(public readonly originTree: Readonly<IWizardTreeState<Step, Category, Branch>>) {}\n}\n\n/**\n * Terminal \"exit\" tree state. Carries the originating tree so listeners can read\n * what state the wizard exited from. Kept as a class so the navigation pipeline can\n * branch on it via `instanceof`.\n */\nexport class WizardExitTreeState<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic readonly state = 'exit' as const;\n\n\tconstructor(public readonly originTree: Readonly<IWizardTreeState<Step, Category, Branch>>) {}\n}\n","import type { IWizardTreeState } from './wizard-tree.state';\n\nimport { WizardCompleteTreeState, WizardExitTreeState } from './wizard-tree.state';\n\n/**\n * Project a navigation target back to its underlying tree.\n *\n * The tree is a structural interface, so the terminal types are standalone\n * classes that wrap an `originTree`. This helper returns whichever tree the\n * static helpers should operate on.\n */\nexport const projectToTree = <Step extends string, Category extends string, Branch extends string>(\n\ttarget:\n\t\t| Readonly<IWizardTreeState<Step, Category, Branch>>\n\t\t| WizardCompleteTreeState<Step, Category, Branch>\n\t\t| WizardExitTreeState<Step, Category, Branch>\n): Readonly<IWizardTreeState<Step, Category, Branch>> =>\n\ttarget instanceof WizardExitTreeState || target instanceof WizardCompleteTreeState ? target.originTree : target;\n","import { wizardRules } from '../rules';\nimport { type IWizardStepState, type IWizardTreeState, WizardCompleteTreeState, WizardExitTreeState } from '../state';\nimport { buildWizardTreeState } from './build-tree-state';\nimport { wizardDefaultState } from './wizard-default.const';\n\ntype MutableStepState<Step extends string, Category extends string, Branch extends string> = {\n\t-readonly [K in keyof IWizardStepState<Step, Category, Branch>]: IWizardStepState<Step, Category, Branch>[K];\n};\n\n/**\n * Mutator for wizard tree state. Fluent API: clone an existing tree, mutate\n * flat per-step flags, then call `build()` to produce a fully-derived (and\n * rule-validated) tree.\n */\nexport class WizardTreeStateBuilder<Step extends string, Category extends string, Branch extends string = string> {\n\tprivate readonly branch: Branch;\n\tprivate readonly state: Array<MutableStepState<Step, Category, Branch>>;\n\n\tconstructor(treeState: Readonly<IWizardTreeState<Step, Category, Branch>>, branch?: Branch | null) {\n\t\tthis.state = treeState.state.map(step => ({ ...step }));\n\t\tthis.branch = (branch ?? treeState.activeBranch.id) as Branch;\n\t}\n\n\tpublic static validate<Step extends string, Category extends string, Branch extends string = string>(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\twizardRules.forEach(rule => rule.verify(tree as Readonly<IWizardTreeState<string, string, string>>));\n\t\treturn tree;\n\t}\n\n\t/** Activate completed steps + the next step after the last completed one. */\n\tpublic activateCategory(categoryId: Category): this {\n\t\tconst shown = this.getCategoryStepStates(categoryId).filter(s => s.isShow);\n\n\t\tfor (let i = 0; i < shown.length; i++) {\n\t\t\tconst step = shown[i]!;\n\t\t\tconst prev = shown[i - 1];\n\t\t\tstep.isActive = step.isCompleted || (prev?.isCompleted ?? true);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/** Activate first shown step of a category; deactivate the rest. */\n\tpublic activateFirstStep(categoryId: Category): this {\n\t\tconst shown = this.getCategoryStepStates(categoryId).filter(step => step.isShow);\n\n\t\tif (shown.length === 0) return this;\n\n\t\tshown[0]!.isActive = true;\n\t\tfor (let i = 1; i < shown.length; i++) {\n\t\t\tshown[i]!.isActive = false;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t// ================\n\t// Step actions\n\t// ================\n\tpublic activateStep(step: Step): this {\n\t\tthis.getStepState(step).isActive = true;\n\t\treturn this;\n\t}\n\n\tpublic build(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst tree = buildWizardTreeState<Step, Category, Branch>(this.state, this.branch);\n\t\tWizardTreeStateBuilder.validate(tree);\n\t\treturn Object.freeze(tree);\n\t}\n\n\t/** Build a terminal complete tree (skips rule validation since the tree is sealed). */\n\tpublic buildComplete(): Readonly<WizardCompleteTreeState<Step, Category, Branch>> {\n\t\tconst tree = buildWizardTreeState<Step, Category, Branch>(this.state, this.branch);\n\t\treturn Object.freeze(new WizardCompleteTreeState(tree));\n\t}\n\n\t/** Build a terminal exit tree (skips rule validation since the tree is sealed). */\n\tpublic buildExit(): Readonly<WizardExitTreeState<Step, Category, Branch>> {\n\t\tconst tree = buildWizardTreeState<Step, Category, Branch>(this.state, this.branch);\n\t\treturn Object.freeze(new WizardExitTreeState(tree));\n\t}\n\n\tpublic completeCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isCompleted = true));\n\t\treturn this;\n\t}\n\n\t// ================\n\t// Category actions\n\t// ================\n\n\tpublic completeStep(step: Step): this {\n\t\tthis.getStepState(step).isCompleted = true;\n\t\treturn this;\n\t}\n\n\tpublic deactivateCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isActive = false));\n\t\treturn this;\n\t}\n\n\tpublic deactivateStep(step: Step): this {\n\t\tthis.getStepState(step).isActive = false;\n\t\treturn this;\n\t}\n\n\tpublic getCategoryStepStates(categoryId: Category): Array<MutableStepState<Step, Category, Branch>> {\n\t\treturn this.state.filter(step => step.categoryId === categoryId);\n\t}\n\n\t/** Reset every step in the tree to `wizardDefaultState`. */\n\tpublic getResetTree(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tthis.state.forEach(step => Object.assign(step, wizardDefaultState));\n\t\tconst firstStep = this.state[0];\n\t\tif (firstStep) {\n\t\t\tfirstStep.isActive = true;\n\t\t}\n\t\treturn Object.freeze(buildWizardTreeState<Step, Category, Branch>(this.state, this.branch));\n\t}\n\n\tpublic getStepState(step: Step): MutableStepState<Step, Category, Branch> {\n\t\tconst found = this.state.find(s => s.id === step);\n\t\tif (!found) {\n\t\t\tthrow new Error(`[WizardTreeStateBuilder] Unknown step \"${step}\"`);\n\t\t}\n\t\treturn found;\n\t}\n\n\tpublic hideCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isShow = false));\n\t\treturn this;\n\t}\n\n\tpublic hideStep(step: Step): this {\n\t\tthis.getStepState(step).isShow = false;\n\t\treturn this;\n\t}\n\n\t/** Reset category steps from `from` index onward; deactivate all but first. */\n\tpublic resetCategory(categoryId: Category, from = 0): this {\n\t\tconst slice = this.getCategoryStepStates(categoryId).slice(from);\n\t\tslice.forEach((step, index) => {\n\t\t\tstep.isActive = step.isActive && index === 0;\n\t\t\tstep.isCompleted = false;\n\t\t});\n\t\treturn this;\n\t}\n\n\tpublic showCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isShow = true));\n\t\treturn this;\n\t}\n\n\t// ================\n\t// Build / reset\n\t// ================\n\n\tpublic showStep(step: Step): this {\n\t\tthis.getStepState(step).isShow = true;\n\t\treturn this;\n\t}\n\n\tpublic skipCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isSkipped = true));\n\t\treturn this;\n\t}\n\n\tpublic skipCategoryUncompleted(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId)\n\t\t\t.filter(step => !step.isCompleted)\n\t\t\t.forEach(step => (step.isSkipped = true));\n\t\treturn this;\n\t}\n\n\tpublic uncompleteStep(step: Step): this {\n\t\tthis.getStepState(step).isCompleted = false;\n\t\treturn this;\n\t}\n\n\tpublic unskipCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isSkipped = false));\n\t\treturn this;\n\t}\n}\n","import type { IWizardConfigOptions } from '../interfaces';\nimport type { WizardInitializer } from './initializers';\nimport type { WizardListener } from './listeners';\nimport type {\n\tWizardProgressStrategy,\n\tWizardScrollContainer,\n\tWizardScrollStrategy,\n\tWizardVisibilityStrategy,\n} from './strategies';\nimport type { WizardEngineStrategies } from './wizard-engine';\n\n/**\n * Aggregated provider props — what `<WizardProvider>` (Phase 15) consumes and\n * passes through to `new WizardEngine(...)`. Built up by chaining `with*`\n * helpers via `composeWizardProviders(...)`.\n */\nexport interface IWizardProviderProps<Step extends string, Category extends string, Branch extends string = string> {\n\tconfig: Partial<IWizardConfigOptions<Category>>;\n\tinitializers: Array<WizardInitializer<Step, Category, Branch>>;\n\tlisteners: Array<WizardListener<Step, Category, Branch>>;\n\tscrollContainer?: WizardScrollContainer;\n\tstrategies: WizardEngineStrategies<Step, Category, Branch>;\n}\n\n/**\n * Modifier function — receives the props in flight, mutates them, returns void.\n * Each `with*` helper returns one of these.\n */\nexport type WizardProviderMod<Step extends string, Category extends string, Branch extends string = string> = (\n\tprops: IWizardProviderProps<Step, Category, Branch>\n) => void;\n\nexport function composeWizardProviders<Step extends string, Category extends string, Branch extends string = string>(\n\t...mods: Array<WizardProviderMod<Step, Category, Branch>>\n): IWizardProviderProps<Step, Category, Branch> {\n\tconst props: IWizardProviderProps<Step, Category, Branch> = {\n\t\tconfig: {},\n\t\tinitializers: [],\n\t\tlisteners: [],\n\t\tstrategies: {},\n\t};\n\n\tfor (const mod of mods) {\n\t\tmod(props);\n\t}\n\n\treturn props;\n}\n\nexport const withConfig =\n\t<Step extends string = string, Category extends string = string, Branch extends string = string>(\n\t\toptions: Partial<IWizardConfigOptions<Category>>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.config = { ...props.config, ...options };\n\t};\n\nexport const withInitializer =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tinitializer: WizardInitializer<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.initializers.push(initializer);\n\t};\n\nexport const withListener =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tlistener: WizardListener<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.listeners.push(listener);\n\t};\n\nexport const withScrollStrategy =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tstrategy: WizardScrollStrategy<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.strategies.scroll = strategy;\n\t};\n\n/**\n * Point the wizard's scroll strategy at a specific element instead of the\n * window. Pass a getter when the container lives behind a React ref so the\n * element resolves at scroll time, after commit.\n */\nexport const withScrollContainer =\n\t<Step extends string = string, Category extends string = string, Branch extends string = string>(\n\t\tcontainer: WizardScrollContainer\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.scrollContainer = container;\n\t};\n\nexport const withProgressStrategy =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tstrategy: WizardProgressStrategy<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.strategies.progress = strategy;\n\t};\n\nexport const withVisibilityStrategy =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tstrategy: WizardVisibilityStrategy<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.strategies.visibility = strategy;\n\t};\n","import type { WizardNavigation } from '../navigation';\n\nimport { WizardEventType } from '../../enums/wizard-event-type.enum';\n\n/**\n * General parent event for all wizard events.\n */\nexport abstract class WizardEvent<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic abstract readonly type: WizardEventType;\n\n\t/** @param navigation - Specific navigation data associated with event */\n\tconstructor(public readonly navigation?: WizardNavigation<Step, Category, Branch>) {}\n}\n\nexport class WizardCompleteEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.Complete = WizardEventType.Complete;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\n/**\n * Exit can be triggered in 2 ways:\n * - as a part of navigation (with navigation data)\n * - before wizard init, where no state exists yet\n */\nexport class WizardExitEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.Exit = WizardEventType.Exit;\n}\n\nexport class WizardNavigationCancelledEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationCancelled = WizardEventType.NavigationCancelled;\n\n\tconstructor(\n\t\tpublic override readonly navigation: WizardNavigation<Step, Category, Branch>,\n\t\tpublic readonly reason: 'new_navigation' | 'resolver'\n\t) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardNavigationEndEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationEnd = WizardEventType.NavigationEnd;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardNavigationErrorEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationError = WizardEventType.NavigationError;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardNavigationIgnoredEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationIgnored = WizardEventType.NavigationIgnored;\n\n\tconstructor(\n\t\tpublic override readonly navigation: WizardNavigation<Step, Category, Branch>,\n\t\tpublic readonly reason: 'same_navigation'\n\t) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardNavigationStartEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationStart = WizardEventType.NavigationStart;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardResolveEndEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.ResolveEnd = WizardEventType.ResolveEnd;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardResolveStartEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.ResolveStart = WizardEventType.ResolveStart;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardScrollEndEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.ScrollEnd = WizardEventType.ScrollEnd;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardScrollStartEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.ScrollStart = WizardEventType.ScrollStart;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardStepHideEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.StepHide = WizardEventType.StepHide;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardStepShowEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.StepShow = WizardEventType.StepShow;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\n/**\n * Base contract for wizard tree-state initializers. Each initializer in a chain\n * receives the result of the previous one (and the original HTML tree) and may\n * mutate the active step / category / completion based on persisted state, URL\n * params, server data, etc.\n */\nexport abstract class WizardInitializer<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic abstract getState(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>,\n\t\thtmlTree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Promise<Readonly<IWizardTreeState<Step, Category, Branch>>> | Readonly<IWizardTreeState<Step, Category, Branch>>;\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardTreeStateBuilder } from '../builders';\nimport { WizardInitializer } from './wizard-initializer';\n\n/**\n * Default initializer: if the tree already has an active step, return it as-is.\n * Otherwise activate the first non-passed category (or the active category as\n * a fallback) so the wizard always boots with a valid active step.\n */\nexport class WizardDefaultInitializer<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardInitializer<Step, Category, Branch> {\n\tpublic override getState(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tif (tree.activeSteps.length > 0) {\n\t\t\treturn builder.build();\n\t\t}\n\n\t\tconst firstUnpassed =\n\t\t\ttree.activeBranch.shownCategories.find(category => !category.isPassed) ?? tree.activeCategory;\n\n\t\treturn builder.activateCategory(firstUnpassed.id).build();\n\t}\n}\n","import type { WizardEvent } from '../events/wizard-events';\nimport type { IWizardTreeState } from '../state';\n\n/**\n * Base contract for wizard lifecycle listeners.\n */\nexport abstract class WizardListener<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic onDestroy(_tree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\treturn;\n\t}\n\n\tpublic onEvent(_event: WizardEvent<Step, Category, Branch>): void {\n\t\treturn;\n\t}\n\n\tpublic onInit(_tree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\treturn;\n\t}\n\n\tpublic onTreeChange(_tree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\treturn;\n\t}\n}\n","import type { WizardInitializer } from '../initializers';\nimport type { IWizardStepState, IWizardTreeState } from '../state';\nimport type { WizardLog } from '../wizard-log';\n\nimport { buildWizardTreeState } from '../builders';\nimport { WizardError, WizardInitializationError } from '../errors';\n\n/**\n * Runs the registered initializer chain on top of the HTML-derived tree to\n * produce the boot state. Validates step uniqueness and active-branch presence\n * before delegating to the chain.\n */\nexport class WizardInitializerService<Step extends string, Category extends string, Branch extends string = string> {\n\tconstructor(\n\t\tprivate readonly wizardLog: WizardLog,\n\t\tprivate readonly wizardInitializers: ReadonlyArray<WizardInitializer<Step, Category, Branch>>\n\t) {}\n\n\tpublic async getInitialState(\n\t\tstate: ReadonlyArray<IWizardStepState<Step, Category, Branch>>,\n\t\tactiveBranch?: Branch\n\t): Promise<Readonly<IWizardTreeState<Step, Category, Branch>>> {\n\t\tconst htmlTree = buildWizardTreeState<Step, Category, Branch>(state, activeBranch);\n\n\t\tthis.wizardLog.trace('HTML tree', htmlTree);\n\n\t\ttry {\n\t\t\tthis.validateHtmlTree(htmlTree);\n\t\t\tthis.validateActiveBranch(htmlTree, activeBranch);\n\n\t\t\tlet tree: Readonly<IWizardTreeState<Step, Category, Branch>> = htmlTree;\n\n\t\t\tfor (const initializer of this.wizardInitializers) {\n\t\t\t\ttree = await initializer.getState(tree, htmlTree);\n\t\t\t\tthis.wizardLog.trace('Initializer', initializer, tree);\n\t\t\t}\n\n\t\t\treturn tree;\n\t\t} catch (e) {\n\t\t\tthis.wizardLog.error(e);\n\t\t\t// Fall back to the HTML-derived tree if any initializer rejects.\n\t\t\treturn htmlTree;\n\t\t}\n\t}\n\n\tprivate validateActiveBranch(\n\t\thtmlTree: Readonly<IWizardTreeState<Step, Category, Branch>>,\n\t\tactiveBranch?: Branch\n\t): void {\n\t\tif (!activeBranch) return;\n\n\t\tif (!htmlTree.branchMap[activeBranch]) {\n\t\t\tconst branchIds = htmlTree.branches.map(branch => branch.id).join(',');\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardInitializerService02]: There is no branch with id \"${activeBranch}\". List of available branches: ${branchIds}.`\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate validateHtmlTree(htmlTree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\tconst seen = new Set<Step>();\n\t\tconst duplicates: Step[] = [];\n\t\tfor (const s of htmlTree.state) {\n\t\t\tif (seen.has(s.id)) duplicates.push(s.id);\n\t\t\telse seen.add(s.id);\n\t\t}\n\n\t\tif (duplicates.length > 0) {\n\t\t\tthrow new WizardInitializationError(\n\t\t\t\t`[WizardInitializerService01]: There are steps with the same ID: ${duplicates.join(',')}.`\n\t\t\t);\n\t\t}\n\t}\n}\n","type Listener<E> = (event: E) => void;\n\n/**\n * Tiny typed event emitter. Subscribers can listen to a specific event type\n * (matched on `event.type`) or via the `'*'` wildcard. Returns an unsubscribe\n * handle from `on()`.\n */\nexport class TypedEmitter<E extends { type: string }> {\n\tprivate readonly map = new Map<'*' | string, Set<Listener<E>>>();\n\n\tpublic dispose(): void {\n\t\tthis.map.clear();\n\t}\n\n\tpublic emit(event: E): void {\n\t\tconst specific = this.map.get(event.type);\n\t\tif (specific) {\n\t\t\tfor (const handler of [...specific]) handler(event);\n\t\t}\n\t\tconst wildcard = this.map.get('*');\n\t\tif (wildcard) {\n\t\t\tfor (const handler of [...wildcard]) handler(event);\n\t\t}\n\t}\n\n\tpublic on(type: '*' | E['type'], handler: Listener<E>): () => void {\n\t\tlet set = this.map.get(type);\n\t\tif (!set) {\n\t\t\tset = new Set();\n\t\t\tthis.map.set(type, set);\n\t\t}\n\t\tset.add(handler);\n\t\treturn () => {\n\t\t\tset!.delete(handler);\n\t\t};\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { projectToTree, WizardCompleteTreeState, WizardExitTreeState } from '../state';\n\nexport class WizardNavigation<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic readonly direction: 'back' | 'next';\n\tpublic readonly id: string;\n\tpublic readonly isCategoryChanging: boolean;\n\tpublic readonly isComplete: boolean;\n\tpublic readonly isExit: boolean;\n\tpublic readonly isScrollChanging: boolean;\n\tpublic readonly isSkipping: boolean;\n\n\tconstructor(\n\t\tpublic readonly from: Readonly<IWizardTreeState<Step, Category, Branch>>,\n\t\tpublic readonly to:\n\t\t\t| Readonly<IWizardTreeState<Step, Category, Branch>>\n\t\t\t| WizardCompleteTreeState<Step, Category, Branch>\n\t\t\t| WizardExitTreeState<Step, Category, Branch>\n\t) {\n\t\tconst toTree = projectToTree(to);\n\n\t\tthis.id = `${from.id}=>${toTree.id}`;\n\t\tthis.direction = WizardNavigation.getDirection(from, toTree);\n\t\tthis.isSkipping = WizardNavigation.isSkipping(from, toTree, this.direction);\n\t\tthis.isCategoryChanging = WizardNavigation.isCategoryChanging(from, toTree);\n\t\tthis.isScrollChanging = WizardNavigation.isScrollChanging(from, toTree);\n\n\t\tthis.isExit = to instanceof WizardExitTreeState;\n\t\tthis.isComplete = to instanceof WizardCompleteTreeState;\n\t}\n\n\tpublic static getDirection(\n\t\tfrom: Readonly<IWizardTreeState<string, string>>,\n\t\tto: Readonly<IWizardTreeState<string, string>>\n\t): 'back' | 'next' {\n\t\t// back/next between categories in branch\n\t\tif (WizardNavigation.isCategoryChanging(from, to)) {\n\t\t\treturn from.activeCategory.htmlIndex > to.activeCategory.htmlIndex ? 'back' : 'next';\n\t\t}\n\n\t\t// back/next on first/last step\n\t\tif (from.activeCategory.activeStepIndex === to.activeCategory.activeStepIndex) {\n\t\t\treturn to.activeCategory.id === to.activeBranch.firstCategory.id ? 'back' : 'next';\n\t\t}\n\n\t\t// back/next between steps in category\n\t\treturn from.activeCategory.activeStepIndex > to.activeCategory.activeStepIndex ? 'back' : 'next';\n\t}\n\n\tpublic static isCategoryChanging(\n\t\tfrom: Readonly<IWizardTreeState<string, string>>,\n\t\tto: Readonly<IWizardTreeState<string, string>>\n\t): boolean {\n\t\treturn from.activeCategory.id !== to.activeCategory.id;\n\t}\n\n\tpublic static isScrollChanging(\n\t\tfrom: Readonly<IWizardTreeState<string, string>>,\n\t\tto: Readonly<IWizardTreeState<string, string>>\n\t): boolean {\n\t\tconst isSamePosition = from.activeCategory.activeStepIndex === to.activeCategory.activeStepIndex;\n\t\tconst isSameStep = from.activeCategory.lastActiveStep.id === to.activeCategory.lastActiveStep.id;\n\n\t\treturn !isSameStep || !isSamePosition;\n\t}\n\n\t/**\n\t * Navigation counted as skipped when Category \"A\" was \"active\" and not \"skipped\" before transition\n\t * and became \"inactive\" and \"skipped\" after transition.\n\t */\n\tpublic static isSkipping(\n\t\tfrom: Readonly<IWizardTreeState<string, string>>,\n\t\tto: Readonly<IWizardTreeState<string, string>>,\n\t\tdirection: 'back' | 'next' = WizardNavigation.getDirection(from, to)\n\t): boolean {\n\t\tif (direction === 'back') {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst isPrevCategoryAlreadySkipped = from.activeCategory.isSkipped;\n\t\tconst isPrevCategorySkipped = to.categoryMap[from.activeCategory.id].isSkipped;\n\n\t\treturn !isPrevCategoryAlreadySkipped && isPrevCategorySkipped;\n\t}\n}\n","import type { IWizardResolverHook } from '../../interfaces';\nimport type { WizardScrollStrategy } from '../strategies';\nimport type { WizardConfig } from '../wizard-config';\nimport type { WizardStore } from '../wizard-store';\n\nimport { WizardEventType } from '../../enums/wizard-event-type.enum';\nimport { WizardResolverError } from '../errors';\nimport {\n\tWizardCompleteEvent,\n\ttype WizardEvent,\n\tWizardExitEvent,\n\tWizardNavigationCancelledEvent,\n\tWizardNavigationEndEvent,\n\tWizardNavigationErrorEvent,\n\tWizardNavigationIgnoredEvent,\n\tWizardNavigationStartEvent,\n\tWizardResolveEndEvent,\n\tWizardResolveStartEvent,\n\tWizardScrollEndEvent,\n\tWizardScrollStartEvent,\n\tWizardStepHideEvent,\n\tWizardStepShowEvent,\n} from '../events/wizard-events';\nimport { type IWizardTreeState, WizardCompleteTreeState, WizardExitTreeState } from '../state';\nimport { toArray } from '../utils';\nimport { type WizardStateResult, WizardStateService } from './state-service';\nimport { TypedEmitter } from './typed-emitter';\nimport { WizardNavigation } from './wizard-navigation';\n\ninterface InFlight<Step extends string, Category extends string, Branch extends string> {\n\tabort: AbortController;\n\tnavigation: WizardNavigation<Step, Category, Branch>;\n}\n\n/**\n * Async navigation pipeline. Each `navigate()` (or `showStep` / `hideStep` /\n * `exitWizard` / `completeWizard`) emits a strict ordering of events:\n *\n * NavigationStart → ResolveStart → resolver chain → ResolveEnd → setState →\n * StepShow/StepHide (visibility flips) → ScrollStart → scroll strategy →\n * ScrollEnd → NavigationEnd (or Exit/Complete for terminals)\n *\n * Race semantics: a new navigate() while another is in flight aborts the prior\n * one (emits `NavigationCancelled('new_navigation')` and resolves the prior\n * Promise to `false`). Resolver returning `false` or rejecting emits\n * `NavigationCancelled('resolver')`. Resolver throwing emits `NavigationError`.\n */\nexport class WizardNavigationService<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic get isNavigating(): boolean {\n\t\treturn !!this.inFlight;\n\t}\n\tprivate disposed = false;\n\tprivate readonly emitter = new TypedEmitter<WizardEvent<Step, Category, Branch>>();\n\tprivate inFlight: InFlight<Step, Category, Branch> | null = null;\n\n\tprivate prevSuccessId: null | string = null;\n\n\tconstructor(\n\t\tprivate readonly wizardStore: WizardStore<Step, Category, Branch>,\n\t\tprivate readonly wizardConfig: WizardConfig<Category>,\n\t\tprivate readonly wizardStateService: WizardStateService<Step, Category, Branch>,\n\t\tprivate readonly wizardScrollStrategy: WizardScrollStrategy<Step, Category, Branch>\n\t) {}\n\n\tpublic async completeWizard(): Promise<boolean> {\n\t\tconst tree = this.wizardStore.getTreeSnapshot();\n\t\tconst to = new WizardCompleteTreeState<Step, Category, Branch>(tree);\n\t\treturn this.navigate(to);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tif (this.inFlight) {\n\t\t\tthis.inFlight.abort.abort();\n\t\t\tthis.inFlight = null;\n\t\t}\n\t\tthis.emitter.dispose();\n\t}\n\n\tpublic async exitWizard(): Promise<boolean> {\n\t\ttry {\n\t\t\tconst tree = this.wizardStore.getTreeSnapshot();\n\t\t\tconst to = new WizardExitTreeState<Step, Category, Branch>(tree);\n\t\t\treturn this.navigate(to);\n\t\t} catch {\n\t\t\t// Wizard not initialized — fire a bare Exit event with no navigation\n\t\t\tthis.emitter.emit(new WizardExitEvent<Step, Category, Branch>());\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic async hideCategory(categoryId: Category): Promise<boolean> {\n\t\tconst to = this.wizardStateService.hideCategory(categoryId);\n\t\treturn this.hide(this.projectTree(to));\n\t}\n\n\tpublic async hideStep(step: Step | Step[]): Promise<boolean> {\n\t\tconst tree = this.wizardStore.getTreeSnapshot();\n\t\tconst to = toArray(step).reduce<WizardStateResult<Step, Category, Branch>>((acc, id) => {\n\t\t\tconst accTree = this.projectTree(acc);\n\t\t\treturn this.wizardStateService.hideStep(id, accTree);\n\t\t}, tree);\n\t\treturn this.hide(this.projectTree(to));\n\t}\n\n\tpublic async navigate(to: WizardStateResult<Step, Category, Branch>): Promise<boolean> {\n\t\tif (this.disposed) return false;\n\n\t\tconst fromTree = this.wizardStore.getTreeSnapshot();\n\t\tconst navigation = new WizardNavigation<Step, Category, Branch>(fromTree, to);\n\n\t\t// Same-navigation guard\n\t\tif (navigation.id === this.prevSuccessId && !navigation.isExit && !navigation.isComplete) {\n\t\t\tthis.emitter.emit(new WizardNavigationIgnoredEvent(navigation, 'same_navigation'));\n\t\t\treturn false;\n\t\t}\n\n\t\t// Cancel any in-flight navigation\n\t\tif (this.inFlight) {\n\t\t\tconst prior = this.inFlight;\n\t\t\tprior.abort.abort();\n\t\t\tthis.inFlight = null;\n\t\t\tthis.emitter.emit(new WizardNavigationCancelledEvent(prior.navigation, 'new_navigation'));\n\t\t}\n\n\t\tconst abort = new AbortController();\n\t\tthis.inFlight = { abort, navigation };\n\n\t\ttry {\n\t\t\tthis.emitter.emit(new WizardNavigationStartEvent(navigation));\n\t\t\tthis.emitter.emit(new WizardResolveStartEvent(navigation));\n\n\t\t\ttry {\n\t\t\t\tawait this.runResolverChain(navigation, abort.signal);\n\t\t\t} catch (e) {\n\t\t\t\tif (this.isAbortReason(e, abort.signal)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (e instanceof WizardResolverError) {\n\t\t\t\t\tthis.emitter.emit(new WizardNavigationCancelledEvent(navigation, 'resolver'));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tthis.emitter.emit(new WizardNavigationErrorEvent(navigation));\n\n\t\t\t\tconsole.error(e);\n\t\t\t\tthrow e;\n\t\t\t}\n\n\t\t\tif (abort.signal.aborted) return false;\n\n\t\t\tthis.emitter.emit(new WizardResolveEndEvent(navigation));\n\n\t\t\t// Commit state\n\t\t\tthis.commitTree(navigation, to);\n\n\t\t\t// Visibility flips\n\t\t\tthis.emitVisibilityFlips(navigation, fromTree, to);\n\n\t\t\t// NavigationEnd / Exit / Complete\n\t\t\tthis.emitter.emit(new WizardNavigationEndEvent(navigation));\n\t\t\tif (navigation.isExit) this.emitter.emit(new WizardExitEvent(navigation));\n\t\t\tif (navigation.isComplete) this.emitter.emit(new WizardCompleteEvent(navigation));\n\n\t\t\t// Scroll (skip on terminals + when no scroll change)\n\t\t\tif (!navigation.isExit && !navigation.isComplete && navigation.isScrollChanging) {\n\t\t\t\tthis.emitter.emit(new WizardScrollStartEvent(navigation));\n\t\t\t\tawait this.wizardScrollStrategy.onNavigate(navigation);\n\t\t\t\tthis.emitter.emit(new WizardScrollEndEvent(navigation));\n\t\t\t}\n\n\t\t\tthis.prevSuccessId = navigation.id;\n\t\t\treturn true;\n\t\t} finally {\n\t\t\tif (this.inFlight && this.inFlight.navigation === navigation) {\n\t\t\t\tthis.inFlight = null;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic on(\n\t\ttype: '*' | WizardEvent<Step, Category, Branch>['type'],\n\t\thandler: (event: WizardEvent<Step, Category, Branch>) => void\n\t): () => void {\n\t\treturn this.emitter.on(type, handler);\n\t}\n\n\tpublic async showCategory(categoryId: Category): Promise<boolean> {\n\t\tconst to = this.wizardStateService.showCategory(categoryId);\n\t\treturn this.show(to);\n\t}\n\n\tpublic async showStep(step: Step | Step[]): Promise<boolean> {\n\t\tconst tree = this.wizardStore.getTreeSnapshot();\n\t\tconst to = toArray(step).reduce<Readonly<IWizardTreeState<Step, Category, Branch>>>(\n\t\t\t(acc, id) => this.wizardStateService.showStep(id, acc),\n\t\t\ttree\n\t\t);\n\t\treturn this.show(to);\n\t}\n\n\t// --- internals ---\n\n\tprivate commitTree(\n\t\tnavigation: WizardNavigation<Step, Category, Branch>,\n\t\tto: WizardStateResult<Step, Category, Branch>\n\t): void {\n\t\tif (navigation.isExit || navigation.isComplete) {\n\t\t\t// Terminal: don't push the terminal state through; keep the originating tree\n\t\t\t// so consumers can still read it. The exit/complete events convey the terminal.\n\t\t\tconst tree = this.projectTree(to);\n\t\t\tthis.wizardStore.setState(tree);\n\t\t\treturn;\n\t\t}\n\t\tthis.wizardStore.setState(to as Readonly<IWizardTreeState<Step, Category, Branch>>);\n\t}\n\n\tprivate emitVisibilityFlips(\n\t\tnavigation: WizardNavigation<Step, Category, Branch>,\n\t\tfrom: Readonly<IWizardTreeState<Step, Category, Branch>>,\n\t\tto: WizardStateResult<Step, Category, Branch>\n\t): void {\n\t\tconst toTree = this.projectTree(to);\n\t\tfor (const stepId of Object.keys(from.stepMap) as Step[]) {\n\t\t\tconst before = from.stepMap[stepId];\n\t\t\tconst after = toTree.stepMap[stepId];\n\t\t\tif (!before || !after) continue;\n\t\t\tif (before.isShow === after.isShow) continue;\n\t\t\tif (after.isShow) {\n\t\t\t\tthis.emitter.emit(new WizardStepShowEvent(navigation));\n\t\t\t} else {\n\t\t\t\tthis.emitter.emit(new WizardStepHideEvent(navigation));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async hide(to: Readonly<IWizardTreeState<Step, Category, Branch>>): Promise<boolean> {\n\t\tconst fromTree = this.wizardStore.getTreeSnapshot();\n\t\tconst navigation = new WizardNavigation<Step, Category, Branch>(fromTree, to);\n\n\t\tthis.wizardStore.setState(to);\n\t\tthis.emitter.emit(new WizardStepHideEvent(navigation));\n\n\t\tif (navigation.isScrollChanging) {\n\t\t\tawait this.wizardScrollStrategy.onToggle(navigation);\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate async invokeResolver(\n\t\tresolver: IWizardResolverHook<Step, Category, Branch> | null | undefined,\n\t\tnavigation: WizardNavigation<Step, Category, Branch>,\n\t\tsignal: AbortSignal\n\t): Promise<void> {\n\t\tif (!resolver) return;\n\t\tif (signal.aborted) throw new DOMException('aborted', 'AbortError');\n\n\t\t// Race the resolver against the abort signal so a cancel-on-new-nav\n\t\t// doesn't have to wait for a long-running resolver to finish.\n\t\tconst abortPromise = new Promise<never>((_, reject) => {\n\t\t\tconst onAbort = () => reject(new DOMException('aborted', 'AbortError'));\n\t\t\tif (signal.aborted) {\n\t\t\t\tonAbort();\n\t\t\t} else {\n\t\t\t\tsignal.addEventListener('abort', onAbort, { once: true });\n\t\t\t}\n\t\t});\n\n\t\tconst result = await Promise.race([Promise.resolve(resolver(navigation as never)), abortPromise]);\n\n\t\tif (signal.aborted) throw new DOMException('aborted', 'AbortError');\n\n\t\tif (!result) {\n\t\t\tthrow new WizardResolverError(`Resolver rejected navigation ${navigation.id}`);\n\t\t}\n\t}\n\n\tprivate isAbortReason(error: unknown, signal: AbortSignal): boolean {\n\t\tif (!signal.aborted) return false;\n\t\tif (error instanceof DOMException && error.name === 'AbortError') return true;\n\t\treturn false;\n\t}\n\n\tprivate projectTree(\n\t\tto: WizardStateResult<Step, Category, Branch>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tif (to instanceof WizardExitTreeState || to instanceof WizardCompleteTreeState) {\n\t\t\treturn to.originTree;\n\t\t}\n\t\treturn to;\n\t}\n\n\tprivate async runResolverChain(\n\t\tnavigation: WizardNavigation<Step, Category, Branch>,\n\t\tsignal: AbortSignal\n\t): Promise<void> {\n\t\tconst config = this.wizardConfig.getOptions();\n\n\t\tif (navigation.direction === 'next' && navigation.isCategoryChanging && !navigation.isSkipping) {\n\t\t\tawait this.invokeResolver(config.resolveCategoryComplete, navigation, signal);\n\t\t}\n\n\t\tif (navigation.isCategoryChanging) {\n\t\t\tawait this.invokeResolver(config.resolveCategoryChange, navigation, signal);\n\t\t}\n\n\t\tif (navigation.isCategoryChanging) {\n\t\t\tawait this.invokeResolver(config.resolveCategoryEnter, navigation, signal);\n\t\t}\n\n\t\tawait this.invokeResolver(config.resolveStepChange, navigation, signal);\n\t}\n\n\tprivate async show(to: WizardStateResult<Step, Category, Branch>): Promise<boolean> {\n\t\tconst fromTree = this.wizardStore.getTreeSnapshot();\n\t\tconst toTree = this.projectTree(to);\n\t\tconst navigation = new WizardNavigation<Step, Category, Branch>(fromTree, toTree);\n\n\t\tthis.wizardStore.setState(toTree);\n\t\tthis.emitter.emit(new WizardStepShowEvent(navigation));\n\n\t\tif (navigation.isScrollChanging) {\n\t\t\tawait this.wizardScrollStrategy.onToggle(navigation);\n\t\t}\n\t\treturn true;\n\t}\n}\n\nexport type { WizardEventType }; // re-export for convenience\n","import type { WizardConfig } from '../wizard-config';\nimport type { WizardStore } from '../wizard-store';\n\nimport { WizardTreeStateBuilder } from '../builders';\nimport { WizardError } from '../errors';\nimport { type IWizardTreeState, WizardCompleteTreeState, WizardExitTreeState } from '../state';\n\n/**\n * Pure-ish next-tree computations. Each method returns a target tree (or a\n * terminal exit/complete subtype) without mutating the store. Methods accept an\n * optional `tree` argument; when omitted they read from the store's current\n * snapshot.\n */\nexport type WizardStateResult<Step extends string, Category extends string, Branch extends string> =\n\t| Readonly<IWizardTreeState<Step, Category, Branch>>\n\t| WizardCompleteTreeState<Step, Category, Branch>\n\t| WizardExitTreeState<Step, Category, Branch>;\n\nexport class WizardStateService<Step extends string, Category extends string, Branch extends string = string> {\n\tconstructor(\n\t\tprivate readonly wizardStore: WizardStore<Step, Category, Branch>,\n\t\tprivate readonly wizardConfig: WizardConfig<Category>\n\t) {}\n\n\tpublic completeCategory(\n\t\tcategory: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch } = tree;\n\t\tconst { activeCategory, nextCategory } = activeBranch;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tbuilder.completeCategory(category);\n\n\t\tif (activeCategory.id === category && nextCategory) {\n\t\t\treturn builder.deactivateCategory(category).activateCategory(nextCategory.id).build();\n\t\t}\n\t\tif (activeCategory.id === category && !nextCategory) {\n\t\t\treturn builder.buildComplete();\n\t\t}\n\t\treturn builder.build();\n\t}\n\n\tpublic goToCategory(\n\t\tcategoryId: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeBranch, activeCategory, branchMap, categoryMap } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst toCategory = categoryMap[categoryId];\n\t\tconst toCategoryFirstBranch = branchMap[toCategory.branches[0]!];\n\t\tconst toCategoryBranch = toCategory.branches.includes(activeBranch.id) ? activeBranch : toCategoryFirstBranch;\n\t\tconst toCategoryIndex = toCategoryBranch.getShownCategoryIndex(toCategory);\n\t\tconst activeCategoryIndex = toCategoryBranch.getShownCategoryIndex(activeCategory);\n\n\t\tif (activeBranch !== toCategoryBranch && toCategoryIndex > activeCategoryIndex) {\n\t\t\tthrow new WizardError(\n\t\t\t\t`[State02]: Trying to switch to category \"${categoryId}\" in different branch \"${toCategoryBranch.id}\" from current active branch \"${activeBranch.id}\", but new category has uncompleted prev category in new branch.`\n\t\t\t);\n\t\t}\n\n\t\tif (toCategoryIndex > activeCategoryIndex) {\n\t\t\tactiveBranch\n\t\t\t\t.getShownCategories(activeCategoryIndex, toCategoryIndex - 1)\n\t\t\t\t.forEach(mid => builder.skipCategoryUncompleted(mid.id));\n\t\t}\n\n\t\tif (this.wizardConfig.getOptions().isBackResetCompleted && toCategoryIndex < activeCategoryIndex) {\n\t\t\tactiveBranch\n\t\t\t\t.getShownCategories(toCategoryIndex + 1, activeCategoryIndex)\n\t\t\t\t.forEach(mid => builder.resetCategory(mid.id));\n\t\t}\n\n\t\tbuilder.deactivateCategory(activeCategory.id);\n\n\t\tif (this.wizardConfig.getOptions().isShowFirstStepOnCategoryChange) {\n\t\t\treturn builder.activateFirstStep(categoryId).build();\n\t\t}\n\n\t\treturn builder.activateCategory(categoryId).build();\n\t}\n\n\tpublic hideCategory(\n\t\tcategoryId: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch, activeCategory } = tree;\n\n\t\tconst projected: Readonly<IWizardTreeState<Step, Category, Branch>> =\n\t\t\tactiveCategory.id === categoryId ? this.projectShownCategory(categoryId, tree) : tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(projected, activeBranch.id);\n\n\t\treturn builder.hideCategory(categoryId).build();\n\t}\n\n\tpublic hideStep(\n\t\tstep: Step,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch, lastActiveStep } = tree;\n\n\t\tconst projected: Readonly<IWizardTreeState<Step, Category, Branch>> =\n\t\t\tlastActiveStep.id === step ? this.projectShownStep(step, tree) : tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(projected, activeBranch.id);\n\n\t\treturn builder.hideStep(step).deactivateStep(step).build();\n\t}\n\n\tpublic next(\n\t\tbranch?: Branch | null,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch, branchMap } = tree;\n\t\tconst nextBranch = branch ? branchMap[branch] : activeBranch;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree, branch ?? activeBranch.id);\n\n\t\tconst activeCategory = nextBranch.activeCategory;\n\t\tconst activeStep = activeCategory.lastActiveStep;\n\n\t\tconst nextCategory = nextBranch.nextCategory;\n\t\tconst nextStep = activeCategory.nextStep;\n\n\t\tif (activeBranch.activeCategory !== nextBranch.activeCategory) {\n\t\t\tthrow new WizardError(\n\t\t\t\t`[State01]: In order to move to the \"${branch}\" branch, you need to have common category between 2 branches`\n\t\t\t);\n\t\t}\n\n\t\tbuilder.unskipCategory(activeCategory.id).completeStep(activeStep.id);\n\n\t\tif (nextStep) {\n\t\t\treturn builder.activateStep(nextStep.id).build();\n\t\t}\n\n\t\tif (nextCategory) {\n\t\t\tbuilder.deactivateCategory(activeCategory.id);\n\n\t\t\tif (this.wizardConfig.getOptions().isShowFirstStepOnCategoryChange) {\n\t\t\t\treturn builder.activateFirstStep(nextCategory.id).build();\n\t\t\t}\n\n\t\t\treturn builder.activateCategory(nextCategory.id).build();\n\t\t}\n\n\t\treturn builder.buildComplete();\n\t}\n\n\tpublic nextCategory(\n\t\tbranch?: Branch | null,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch, branchMap } = tree;\n\t\tconst nextBranch = branch ? branchMap[branch] : activeBranch;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree, branch ?? activeBranch.id);\n\n\t\tconst activeCategory = nextBranch.activeCategory;\n\t\tconst activeStep = activeCategory.lastActiveStep;\n\t\tconst nextCategory = nextBranch.nextCategory;\n\n\t\tif (activeBranch.activeCategory !== nextBranch.activeCategory) {\n\t\t\tthrow new WizardError(\n\t\t\t\t`[State01]: In order to move to the \"${branch}\" branch, you need to have common category between 2 branches`\n\t\t\t);\n\t\t}\n\n\t\tbuilder.deactivateCategory(activeCategory.id).completeStep(activeStep.id);\n\n\t\tif (nextCategory) {\n\t\t\tbuilder.skipCategoryUncompleted(activeCategory.id);\n\n\t\t\tif (this.wizardConfig.getOptions().isShowFirstStepOnCategoryChange) {\n\t\t\t\treturn builder.activateFirstStep(nextCategory.id).build();\n\t\t\t}\n\n\t\t\treturn builder.activateCategory(nextCategory.id).build();\n\t\t}\n\n\t\treturn builder.buildComplete();\n\t}\n\n\tpublic prev(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst activeCategory = activeBranch.activeCategory;\n\t\tconst activeStep = activeCategory.lastActiveStep;\n\n\t\tconst prevCategory = activeBranch.prevCategory;\n\t\tconst prevStep = activeCategory.prevStep;\n\n\t\tif (this.wizardConfig.getOptions().isBackResetCompleted) {\n\t\t\tbuilder.uncompleteStep(activeStep.id);\n\t\t}\n\n\t\tif (prevStep) {\n\t\t\treturn builder.deactivateStep(activeStep.id).build();\n\t\t}\n\n\t\tif (prevCategory) {\n\t\t\treturn builder.deactivateCategory(activeCategory.id).activateCategory(prevCategory.id).build();\n\t\t}\n\n\t\treturn builder.buildExit();\n\t}\n\n\tpublic prevCategory(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst activeCategory = activeBranch.activeCategory;\n\t\tconst prevCategory = activeBranch.prevCategory;\n\n\t\tif (prevCategory && this.wizardConfig.getOptions().isBackResetCompleted) {\n\t\t\tbuilder.resetCategory(activeCategory.id);\n\t\t}\n\n\t\tif (prevCategory) {\n\t\t\treturn builder.deactivateCategory(activeCategory.id).activateCategory(prevCategory.id).build();\n\t\t}\n\n\t\treturn builder.buildExit();\n\t}\n\n\tpublic resetCategory(\n\t\tcategory: Category,\n\t\tfrom = 0,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeCategory } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tbuilder.resetCategory(category, from);\n\n\t\tif (activeCategory.id === category) {\n\t\t\treturn builder.activateStep(activeCategory.firstStep.id).build();\n\t\t}\n\t\treturn builder.build();\n\t}\n\n\tpublic resetTree(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst reset = new WizardTreeStateBuilder<Step, Category, Branch>(tree).getResetTree();\n\n\t\treturn new WizardTreeStateBuilder<Step, Category, Branch>(reset, tree.activeBranch.id)\n\t\t\t.activateStep(reset.activeCategory.firstStep.id)\n\t\t\t.build();\n\t}\n\n\tpublic showCategory(\n\t\tcategoryId: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeBranch } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst activeCategoryIndex = activeBranch.categories.indexOf(activeBranch.activeCategory);\n\t\tconst categoryIndex = activeBranch.categories.findIndex(category => category.id === categoryId);\n\t\tconst isBeforeActiveCategory = activeCategoryIndex > categoryIndex;\n\n\t\tbuilder.showCategory(categoryId);\n\t\tif (isBeforeActiveCategory) builder.skipCategory(categoryId);\n\n\t\treturn builder.build();\n\t}\n\n\tpublic showStep(\n\t\tstep: Step,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeCategory, lastActiveStep, stepMap } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst stepState = stepMap[step];\n\t\tconst isInActiveCategory = activeCategory.steps.some(s => s.id === step);\n\t\tconst isBeforeLastActiveStep = lastActiveStep.htmlIndex > stepState.htmlIndex;\n\n\t\tbuilder.showStep(step);\n\n\t\tif (isBeforeLastActiveStep) builder.completeStep(step);\n\t\tif (isInActiveCategory && isBeforeLastActiveStep) builder.activateStep(step);\n\n\t\treturn builder.build();\n\t}\n\n\tpublic skipCategory(\n\t\tcategory: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch } = tree;\n\t\tconst { activeCategory, nextCategory } = activeBranch;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tbuilder.skipCategory(category);\n\n\t\tif (activeCategory.id === category && nextCategory) {\n\t\t\treturn builder.deactivateCategory(category).activateCategory(nextCategory.id).build();\n\t\t}\n\t\tif (activeCategory.id === category && !nextCategory) {\n\t\t\treturn builder.buildComplete();\n\t\t}\n\t\treturn builder.build();\n\t}\n\n\tprivate currentTree(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\treturn this.wizardStore.getTreeSnapshot();\n\t}\n\n\tprivate projectShownCategory(\n\t\tcategoryId: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeBranch } = tree;\n\t\tconst result =\n\t\t\tcategoryId === activeBranch.firstCategory.id ? this.nextCategory(null, tree) : this.prevCategory(tree);\n\n\t\treturn result as Readonly<IWizardTreeState<Step, Category, Branch>>;\n\t}\n\n\tprivate projectShownStep(\n\t\tstep: Step,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeBranch, activeCategory, stepMap } = tree;\n\t\tconst stepState = stepMap[step];\n\n\t\tconst isFirstCategory = stepState.categoryId === activeBranch.firstCategory.id;\n\t\tconst isFirstStep = step === activeCategory.firstStep.id;\n\n\t\tconst result = isFirstCategory && isFirstStep ? this.next(null, tree) : this.prev(tree);\n\n\t\t// projectShownStep is only called when projection is required for an active step.\n\t\t// Result must be a non-terminal tree (otherwise the wizard would have completed/exited).\n\t\treturn result as Readonly<IWizardTreeState<Step, Category, Branch>>;\n\t}\n}\n","import type { IWizardTreeState } from '../../state';\n\n/**\n * Minimal structural shape of `WizardConfig` used by the completed-progress\n * strategy for its `isBackResetCompleted` interaction warning.\n */\nexport interface IWizardProgressConfigLike {\n\treadonly isBackResetCompleted: boolean;\n}\n\n/**\n * Minimal structural shape of `WizardLog` used by the completed-progress\n * strategy to surface a configuration warning.\n */\nexport interface IWizardProgressLogLike {\n\terror(error: Error): void;\n}\n\n/**\n * Strategy for calculating wizard progress (per-category percentage 0-100).\n */\nexport abstract class WizardProgressStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> {\n\tpublic abstract getProgress(tree: Readonly<IWizardTreeState<Step, Category, Branch>>): Record<Category, number>;\n}\n","import type { IWizardTreeState } from '../../state';\n\nimport { WizardProgressStrategy } from './wizard-progress.strategy';\n\n/**\n * Default progress strategy: progress to the last active step of each category.\n * Past categories report 100; future ones report 0; the active category reports\n * `(activeSteps.length - 1) * 100 / shownSteps.length`.\n */\nexport class WizardActiveProgressStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardProgressStrategy<Step, Category, Branch> {\n\tpublic override getProgress(tree: Readonly<IWizardTreeState<Step, Category, Branch>>): Record<Category, number> {\n\t\tconst { activeCategory, categoryMap } = tree;\n\t\tconst progress = {} as Record<Category, number>;\n\n\t\tfor (const category of Object.keys(categoryMap) as Category[]) {\n\t\t\tconst categoryState = categoryMap[category];\n\n\t\t\tif (categoryState.htmlIndex !== activeCategory.htmlIndex) {\n\t\t\t\tprogress[category] = categoryState.htmlIndex < activeCategory.htmlIndex ? 100 : 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tprogress[category] =\n\t\t\t\tcategoryState.shownSteps.length > 0\n\t\t\t\t\t? ((categoryState.activeSteps.length - 1) * 100) / categoryState.shownSteps.length\n\t\t\t\t\t: 0;\n\t\t}\n\n\t\treturn progress;\n\t}\n}\n","import type { WizardNavigation } from '../../navigation/wizard-navigation';\n\nimport { projectToTree } from '../../state';\n\n/**\n * Where the wizard should scroll. Accepts an element directly, a React-style\n * ref object, or a getter — the last two resolve lazily, which is required\n * when the container lives behind a ref (refs are populated after the engine\n * is built). When omitted, the strategy scrolls the page (`window`).\n */\nexport type WizardScrollContainer =\n\t| (() => HTMLElement | null)\n\t| HTMLElement\n\t| null\n\t| { readonly current: HTMLElement | null };\n\n/**\n * Strategy for scrolling between steps in the wizard.\n *\n * Backed by native `Element.scrollIntoView({ behavior, block })`. Smooth/instant\n * variants ship as separate strategies. A scroll container can be attached via\n * `setContainer` (typically by the engine, fed from `withScrollContainer`); the\n * container takes over scroll-to-top from `window`. Step-anchored scrolls keep\n * using `scrollIntoView`, which already walks up to the nearest scrollable\n * ancestor, so the container does not need to be re-resolved per element.\n */\nexport abstract class WizardScrollStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> {\n\t// Thin re-export so subclasses keep the existing call site.\n\tprotected static projectToTree = projectToTree;\n\n\tprotected container?: WizardScrollContainer;\n\n\t/** Called by the navigation pipeline after `setState` lands a new tree. */\n\tpublic abstract onNavigate(navigation: WizardNavigation<Step, Category, Branch>): Promise<boolean>;\n\n\t/** Called when toggling step/category visibility (instant scroll by default). */\n\tpublic onToggle(navigation: WizardNavigation<Step, Category, Branch>): Promise<boolean> {\n\t\tconst tree = projectToTree(navigation.to);\n\t\tif (!tree) return Promise.resolve(false);\n\n\t\tconst isFirstStepOfCategory = tree.lastActiveStep?.id === tree.activeCategory.firstStep?.id;\n\t\treturn scrollToStep(isFirstStepOfCategory ? null : tree.lastActiveStep?.id, 'auto', this.container);\n\t}\n\n\t/**\n\t * Imperative scroll-to-top of the configured container (or window). Useful\n\t * for surfacing top-of-page state — e.g. an error banner — after a failed\n\t * submit, without re-running the navigation pipeline.\n\t */\n\tpublic scrollToTop(behavior: 'auto' | 'smooth' = 'smooth'): Promise<boolean> {\n\t\treturn scrollToStep(null, behavior, this.container);\n\t}\n\n\tpublic setContainer(container?: WizardScrollContainer): void {\n\t\tthis.container = container;\n\t}\n}\n\n/**\n * Internal helper: scroll to a step by element id (or to the top for `null`).\n * SSR-safe (no-op when `document` is unavailable). Honors `prefers-reduced-motion`\n * by silently downgrading 'smooth' to 'auto'. When `container` is provided, the\n * scroll-to-top case targets that element instead of `window`.\n */\nexport function scrollToStep(\n\tstepId: null | string | undefined,\n\tbehavior: 'auto' | 'instant' | 'smooth',\n\tcontainer?: WizardScrollContainer\n): Promise<boolean> {\n\tif (typeof document === 'undefined') return Promise.resolve(false);\n\n\tconst reducedMotion =\n\t\ttypeof window !== 'undefined' && typeof window.matchMedia === 'function'\n\t\t\t? window.matchMedia('(prefers-reduced-motion: reduce)').matches\n\t\t\t: false;\n\tconst effectiveBehavior: 'auto' | 'instant' | 'smooth' = reducedMotion ? 'auto' : behavior;\n\n\tif (!stepId) {\n\t\tconst containerEl = resolveScrollContainer(container);\n\t\tif (containerEl) {\n\t\t\tcontainerEl.scrollTo({ behavior: effectiveBehavior, top: 0 });\n\t\t} else if (typeof window !== 'undefined') {\n\t\t\twindow.scrollTo({ behavior: effectiveBehavior, top: 0 });\n\t\t}\n\t\treturn Promise.resolve(true);\n\t}\n\n\tconst element = document.getElementById(stepId);\n\tif (!element) return Promise.resolve(false);\n\n\telement.scrollIntoView({ behavior: effectiveBehavior, block: 'start' });\n\treturn Promise.resolve(true);\n}\n\nfunction resolveScrollContainer(c: undefined | WizardScrollContainer): HTMLElement | null {\n\tif (!c) return null;\n\tif (typeof c === 'function') return c();\n\tif ('current' in c) return c.current;\n\treturn c;\n}\n","import type { WizardNavigation } from '../../navigation/wizard-navigation';\n\nimport { scrollToStep, WizardScrollStrategy } from './wizard-scroll.strategy';\n\n/**\n * Minimal structural shape of `WizardConfig` used by the smooth scroll strategy.\n * Phase 7 replaces this with the concrete class.\n */\nexport interface IWizardScrollConfigLike {\n\treadonly isMobile: boolean;\n}\n\n/**\n * Smooth-scroll strategy. Scrolls to the active step on every navigation;\n * downgrades to instant scroll on category transitions, on mobile, and when\n * `prefers-reduced-motion: reduce` is set.\n */\nexport class WizardSmoothScrollStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardScrollStrategy<Step, Category, Branch> {\n\tconstructor(private readonly wizardConfig?: IWizardScrollConfigLike) {\n\t\tsuper();\n\t}\n\n\tpublic override onNavigate(navigation: WizardNavigation<Step, Category, Branch>): Promise<boolean> {\n\t\tconst tree = WizardScrollStrategy.projectToTree(navigation.to);\n\t\tif (!tree) return Promise.resolve(false);\n\n\t\tconst isFirstStepOfCategory = tree.lastActiveStep?.id === tree.activeCategory.firstStep?.id;\n\t\tconst stepId = isFirstStepOfCategory ? null : tree.lastActiveStep?.id;\n\n\t\tconst useInstant = navigation.isCategoryChanging || (this.wizardConfig?.isMobile ?? false);\n\t\treturn scrollToStep(stepId, useInstant ? 'auto' : 'smooth', this.container);\n\t}\n}\n","import type { IWizardStepState, IWizardTreeState } from '../../state';\n\n/**\n * Minimal structural shape of `WizardConfig` used by visibility strategies.\n * Phase 7 replaces this with the concrete class.\n */\nexport interface IWizardVisibilityConfigLike {\n\treadonly isMobile: boolean;\n}\n\n/**\n * Strategy for calculating which wizard steps are visible (mounted in the DOM).\n */\nexport abstract class WizardVisibilityStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> {\n\tpublic abstract isStepVisible(\n\t\tstep: IWizardStepState<Step, Category, Branch>,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): boolean;\n}\n","import type { IWizardStepState, IWizardTreeState } from '../../state';\n\nimport { type IWizardVisibilityConfigLike, WizardVisibilityStrategy } from './wizard-visibility.strategy';\n\n/**\n * Default visibility: show all active steps of the active category on desktop;\n * show only the last active step on mobile.\n */\nexport class WizardDefaultVisibilityStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardVisibilityStrategy<Step, Category, Branch> {\n\tconstructor(private readonly wizardConfig: IWizardVisibilityConfigLike) {\n\t\tsuper();\n\t}\n\n\tpublic override isStepVisible(\n\t\tstep: IWizardStepState<Step, Category, Branch>,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): boolean {\n\t\tconst isShowStep = step.isActive && step.isShow;\n\t\tconst isLastActiveStep = step.id === tree.lastActiveStep?.id;\n\n\t\treturn this.wizardConfig.isMobile ? isShowStep && isLastActiveStep : isShowStep;\n\t}\n}\n","import type { IWizardStepState, IWizardTreeState } from '../../state';\n\nimport { WizardVisibilityStrategy } from './wizard-visibility.strategy';\n\n/**\n * Show only the last active step of the category.\n */\nexport class WizardLastActiveVisibilityStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardVisibilityStrategy<Step, Category, Branch> {\n\tpublic override isStepVisible(\n\t\tstep: IWizardStepState<Step, Category, Branch>,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): boolean {\n\t\tconst isShowStep = step.isActive && step.isShow;\n\t\tconst isLastActiveStep = step.id === tree.lastActiveStep?.id;\n\n\t\treturn isShowStep && isLastActiveStep;\n\t}\n}\n","import type { IWizardConfigOptions, IWizardResolverHook } from '../interfaces';\n\n/**\n * English defaults for `IWizardConfigOptions`. Consumers override locale-sensitive\n * fields via `<WizardProvider config={{ nextBtnText: t\\`Next\\` }}>` in the React\n * adapter (Phase 15), so the framework-free core never depends on Lingui.\n */\nconst passResolver: IWizardResolverHook<string, string, string> = () => true;\n\nexport const wizardDefaultConfig: IWizardConfigOptions = {\n\tbackBtnClass: '',\n\tbackBtnText: 'Back',\n\n\tdoneDotText: 'Finish',\n\tenableTracing: 'none',\n\n\tfinishText: 'Finish',\n\theaderI18n: null,\n\tisActiveCategoryClickReset: true,\n\tisBackResetCompleted: true,\n\tisDoneDot: false,\n\n\tisShowFirstStepOnCategoryChange: false,\n\tisShowWizardHeader: true,\n\n\tisShowWizardHeaderSteps: true,\n\tnextBtnClass: '',\n\tnextBtnText: 'Next',\n\tnextCategoryText: 'Continue',\n\tresolveCategoryChange: passResolver,\n\tresolveCategoryComplete: passResolver,\n\n\tresolveCategoryEnter: passResolver,\n\tresolveStepChange: passResolver,\n\tsilenceErrors: false,\n\tstickyHeader: true,\n};\n","import type { IWizardConfigOptions } from '../interfaces';\n\nimport { wizardDefaultConfig } from './wizard-default.config';\n\ntype ConfigListener<Category extends string> = (config: Readonly<IWizardConfigOptions<Category>>) => void;\n\n/**\n * Holds the merged wizard config and notifies subscribers on change.\n *\n * Multiple `setOptions` calls within one microtask coalesce into a single\n * notification.\n */\nexport class WizardConfig<Category extends string = string> {\n\t/**\n\t * Whether the wizard is rendering on a mobile viewport. Used by the default\n\t * visibility and scroll strategies. The React adapter (Phase 15) updates this\n\t * via a media-query subscription; in plain Node (tests/SSR), it stays `false`.\n\t */\n\tpublic isMobile = false;\n\tpublic get options(): Readonly<IWizardConfigOptions<Category>> {\n\t\treturn this.current;\n\t}\n\tprivate current: IWizardConfigOptions<Category>;\n\tprivate disposed = false;\n\tprivate readonly listeners = new Set<ConfigListener<Category>>();\n\n\tprivate notifyScheduled = false;\n\n\tconstructor(overrides: Partial<IWizardConfigOptions<Category>> = {}) {\n\t\tthis.current = { ...(wizardDefaultConfig as IWizardConfigOptions<Category>), ...overrides };\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.listeners.clear();\n\t}\n\n\tpublic getOptions(): Readonly<IWizardConfigOptions<Category>> {\n\t\treturn this.current;\n\t}\n\n\tpublic setOptions(options: Partial<IWizardConfigOptions<Category>>): this {\n\t\tif (this.disposed) return this;\n\n\t\tlet changed = false;\n\t\tfor (const k of Object.keys(options) as Array<keyof IWizardConfigOptions<Category>>) {\n\t\t\tif (!Object.is(options[k], this.current[k])) {\n\t\t\t\tchanged = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!changed) return this;\n\n\t\tthis.current = { ...this.current, ...options };\n\t\tthis.scheduleNotify();\n\t\treturn this;\n\t}\n\n\tpublic subscribe(listener: ConfigListener<Category>): () => void {\n\t\tif (this.disposed) return () => {};\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\tprivate scheduleNotify(): void {\n\t\tif (this.notifyScheduled) return;\n\t\tthis.notifyScheduled = true;\n\n\t\tqueueMicrotask(() => {\n\t\t\tthis.notifyScheduled = false;\n\t\t\tif (this.disposed) return;\n\n\t\t\tconst snapshot = this.current;\n\t\t\tfor (const listener of [...this.listeners]) {\n\t\t\t\tlistener(snapshot);\n\t\t\t}\n\t\t});\n\t}\n}\n","import type { IWizardConfigOptions } from '../interfaces';\n\nimport { WizardError } from './errors';\n\n/**\n * Minimal structural shape of `WizardConfig` consumed by `WizardLog` —\n * it reads `enableTracing` and `silenceErrors` only. Phase 7's `WizardConfig`\n * class structurally satisfies this interface (it exposes `getOptions()`).\n */\nexport interface IWizardLogConfigLike {\n\tgetOptions(): Pick<IWizardConfigOptions, 'enableTracing' | 'silenceErrors'>;\n}\n\n/**\n * Console-based logger. Respects `config.enableTracing` for `trace()` and\n * `config.silenceErrors` for `WizardError` instances.\n */\nexport class WizardLog {\n\tconstructor(private readonly wizardConfig: IWizardLogConfigLike) {}\n\n\tpublic error(e: unknown): void {\n\t\tif (!(e instanceof WizardError)) {\n\t\t\tconsole.error(e);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.wizardConfig.getOptions().silenceErrors) {\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.error(e);\n\t}\n\n\tpublic trace(...args: unknown[]): void {\n\t\tif (this.wizardConfig.getOptions().enableTracing !== 'none') {\n\t\t\tconsole.log(...args);\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from './state';\n\nimport { WizardInitializationError } from './errors';\nimport { getShapeId } from './utils';\n\ntype StoreListener = () => void;\n\n/**\n * Holds the current wizard tree, exposes a `useSyncExternalStore`-shaped\n * subscription, and gates `setState` calls behind `init()`.\n */\nexport class WizardStore<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic readonly initOnce: Promise<Readonly<IWizardTreeState<Step, Category, Branch>>>;\n\tpublic get shapeId(): string {\n\t\treturn this._shapeId ?? '';\n\t}\n\tprivate _shapeId: null | string = null;\n\tprivate current: null | Readonly<IWizardTreeState<Step, Category, Branch>> = null;\n\tprivate disposed = false;\n\n\tprivate initialTree: null | Readonly<IWizardTreeState<Step, Category, Branch>> = null;\n\n\tprivate readonly listeners = new Set<StoreListener>();\n\n\tprivate resolveInitOnce!: (tree: Readonly<IWizardTreeState<Step, Category, Branch>>) => void;\n\n\tconstructor(private readonly storagePrefix?: number | string) {\n\t\tthis.initOnce = new Promise(resolve => {\n\t\t\tthis.resolveInitOnce = resolve;\n\t\t});\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.listeners.clear();\n\t}\n\n\tpublic getTreeSnapshot(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tif (!this.current) {\n\t\t\tthrow new WizardInitializationError('[WizardStore] getTreeSnapshot called before init');\n\t\t}\n\t\treturn this.current;\n\t}\n\n\tpublic init(initialTree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\tif (this.disposed) return;\n\n\t\tif (this.initialTree) {\n\t\t\t// Idempotent — log via console for now; the engine emits a NavigationIgnored later\n\n\t\t\tconsole.warn('[WizardStore] init() called more than once; ignoring subsequent call.');\n\t\t\treturn;\n\t\t}\n\n\t\tthis.initialTree = initialTree;\n\t\tthis._shapeId = getShapeId(initialTree.state, this.storagePrefix);\n\t\tthis.setState(initialTree);\n\t\tthis.resolveInitOnce(initialTree);\n\t}\n\n\tpublic setState(tree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\tif (this.disposed) return;\n\n\t\tif (!this.initialTree) {\n\t\t\tthrow new WizardInitializationError('[WizardStore] setState called before init');\n\t\t}\n\n\t\tif (this.current === tree) return;\n\n\t\tthis.current = tree;\n\t\tfor (const listener of [...this.listeners]) {\n\t\t\tlistener();\n\t\t}\n\t}\n\n\tpublic subscribe = (listener: StoreListener): (() => void) => {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t};\n}\n","import type { IWizardConfigOptions } from '../interfaces';\nimport type { WizardEvent } from './events/wizard-events';\nimport type { WizardInitializer } from './initializers';\nimport type { WizardListener } from './listeners';\nimport type { IWizardStepState, IWizardTreeState } from './state';\nimport type {\n\tWizardProgressStrategy,\n\tWizardScrollContainer,\n\tWizardScrollStrategy,\n\tWizardVisibilityStrategy,\n} from './strategies';\n\nimport { WizardDefaultInitializer } from './initializers';\nimport { WizardInitializerService } from './navigation/initializer-service';\nimport { WizardNavigationService } from './navigation/navigation-service';\nimport { WizardStateService } from './navigation/state-service';\nimport {\n\tWizardActiveProgressStrategy,\n\tWizardDefaultVisibilityStrategy,\n\tWizardSmoothScrollStrategy,\n} from './strategies';\nimport { WizardConfig } from './wizard-config';\nimport { WizardLog } from './wizard-log';\nimport { WizardStore } from './wizard-store';\n\nexport interface WizardEngineOptions<Step extends string, Category extends string, Branch extends string = string> {\n\tactiveBranch?: Branch;\n\tconfig?: Partial<IWizardConfigOptions<Category>>;\n\tinitializers?: ReadonlyArray<WizardInitializer<Step, Category, Branch>>;\n\tlisteners?: ReadonlyArray<WizardListener<Step, Category, Branch>>;\n\tscrollContainer?: WizardScrollContainer;\n\tstate: ReadonlyArray<WizardEngineStepRegistration<Step, Category, Branch>>;\n\tstrategies?: WizardEngineStrategies<Step, Category, Branch>;\n}\n\n/**\n * Step-shape descriptor passed to the engine when constructing it. The full\n * `WizardStep` per-step UI control object lives in the React adapter (Phase 15);\n * the engine itself only needs the flat per-step state plus the categoryId so\n * it can build a tree.\n */\nexport type WizardEngineStepRegistration<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> = IWizardStepState<Step, Category, Branch>;\n\nexport interface WizardEngineStrategies<Step extends string, Category extends string, Branch extends string = string> {\n\tprogress?: WizardProgressStrategy<Step, Category, Branch>;\n\tscroll?: WizardScrollStrategy<Step, Category, Branch>;\n\tvisibility?: WizardVisibilityStrategy<Step, Category, Branch>;\n}\n\n/**\n * Top-level wizard façade. Framework-free: pass plain objects in, subscribe via\n * `subscribe()` / `on()`, control via the imperative methods.\n */\nexport class WizardEngine<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic get configOptions(): Readonly<IWizardConfigOptions<Category>> {\n\t\treturn this.config.options;\n\t}\n\tpublic get isInitialized(): boolean {\n\t\treturn this.initialized;\n\t}\n\tpublic get lastActiveStep(): IWizardStepState<Step, Category, Branch> {\n\t\treturn this.tree.lastActiveStep;\n\t}\n\tpublic get progress(): Record<Category, number> {\n\t\treturn this.progressStrategy.getProgress(this.tree);\n\t}\n\tpublic get shapeId(): string {\n\t\treturn this.store.shapeId;\n\t}\n\tpublic get steps(): Readonly<Record<Step, IWizardStepState<Step, Category, Branch>>> {\n\t\treturn this.tree.stepMap;\n\t}\n\tpublic get tree(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\treturn this.store.getTreeSnapshot();\n\t}\n\tprivate committed = false; // commitRegistration() entered\n\tprivate readonly config: WizardConfig<Category>;\n\n\tprivate disposed = false;\n\tprivate readonly initialBranch?: Branch;\n\tprivate initialized = false; // store.init() ran successfully\n\n\tprivate readonly initialState: ReadonlyArray<WizardEngineStepRegistration<Step, Category, Branch>>;\n\tprivate readonly initService: WizardInitializerService<Step, Category, Branch>;\n\tprivate readonly listeners: ReadonlyArray<WizardListener<Step, Category, Branch>>;\n\n\tprivate readonly log: WizardLog;\n\n\t// ------------- snapshots -------------\n\n\tprivate readonly navService: WizardNavigationService<Step, Category, Branch>;\n\n\tprivate readonly pendingPostInitTasks: Array<{\n\t\treadonly resolve: (value: boolean) => void;\n\t\treadonly run: () => void;\n\t}> = [];\n\n\tprivate readonly progressStrategy: WizardProgressStrategy<Step, Category, Branch>;\n\n\tprivate readonly scrollStrategy: WizardScrollStrategy<Step, Category, Branch>;\n\n\tprivate readonly stateService: WizardStateService<Step, Category, Branch>;\n\n\tprivate readonly store: WizardStore<Step, Category, Branch>;\n\n\tprivate readonly visibilityStrategy: WizardVisibilityStrategy<Step, Category, Branch>;\n\n\tconstructor(options: WizardEngineOptions<Step, Category, Branch>) {\n\t\tthis.config = new WizardConfig<Category>(options.config ?? {});\n\t\tconst storagePrefix = (options.config?.storagePrefix ?? undefined) as number | string | undefined;\n\t\tthis.store = new WizardStore<Step, Category, Branch>(storagePrefix);\n\t\tthis.log = new WizardLog(this.config);\n\n\t\tthis.scrollStrategy =\n\t\t\toptions.strategies?.scroll ?? new WizardSmoothScrollStrategy<Step, Category, Branch>(this.config);\n\t\tif (options.scrollContainer !== undefined) {\n\t\t\tthis.scrollStrategy.setContainer(options.scrollContainer);\n\t\t}\n\t\tthis.visibilityStrategy =\n\t\t\toptions.strategies?.visibility ?? new WizardDefaultVisibilityStrategy<Step, Category, Branch>(this.config);\n\t\tthis.progressStrategy =\n\t\t\toptions.strategies?.progress ?? new WizardActiveProgressStrategy<Step, Category, Branch>();\n\n\t\tthis.stateService = new WizardStateService<Step, Category, Branch>(this.store, this.config);\n\t\tthis.navService = new WizardNavigationService<Step, Category, Branch>(\n\t\t\tthis.store,\n\t\t\tthis.config,\n\t\t\tthis.stateService,\n\t\t\tthis.scrollStrategy\n\t\t);\n\n\t\tconst initializers = options.initializers ?? [new WizardDefaultInitializer<Step, Category, Branch>()];\n\t\tthis.initService = new WizardInitializerService<Step, Category, Branch>(this.log, initializers);\n\n\t\tthis.listeners = options.listeners ?? [];\n\t\tthis.initialState = options.state;\n\t\tthis.initialBranch = options.activeBranch;\n\t}\n\n\t// ------------- React adapter wiring -------------\n\n\tpublic back(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.prev()));\n\t}\n\tpublic backCategory(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.prevCategory()));\n\t}\n\n\tpublic async commitRegistration(): Promise<void> {\n\t\tif (this.disposed) return;\n\t\tif (this.committed) return;\n\t\tthis.committed = true;\n\n\t\tconst tree = await this.initService.getInitialState(this.initialState, this.initialBranch);\n\n\t\t// React 19 Strict Mode can dispose the engine while we're awaiting the\n\t\t// initializer chain. Bail out before touching the store/listeners — but\n\t\t// drain queued tasks so callers' awaits resolve to `false` rather than\n\t\t// hanging forever.\n\t\tif (this.disposed) {\n\t\t\tfor (const task of this.pendingPostInitTasks.splice(0)) task.resolve(false);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.store.init(tree);\n\t\tthis.initialized = true;\n\n\t\t// Fan-out onInit to listeners (after store is ready so listener handlers\n\t\t// that read engine state see the live tree)\n\t\tfor (const listener of this.listeners) {\n\t\t\ttry {\n\t\t\t\tlistener.onInit(tree);\n\t\t\t} catch (e) {\n\t\t\t\tthis.log.error(e);\n\t\t\t}\n\t\t}\n\n\t\t// Wire onTreeChange to store updates\n\t\tthis.store.subscribe(() => {\n\t\t\tconst current = this.store.getTreeSnapshot();\n\t\t\tfor (const listener of this.listeners) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener.onTreeChange(current);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.log.error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// Wire onEvent to nav service\n\t\tthis.navService.on('*', event => {\n\t\t\tfor (const listener of this.listeners) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener.onEvent(event);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.log.error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// Drain any navigations queued before commit (init-queue pattern)\n\t\tfor (const task of this.pendingPostInitTasks.splice(0)) {\n\t\t\ttask.run();\n\t\t}\n\t}\n\n\t// ------------- bootstrap -------------\n\n\tpublic completeWizard(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.completeWizard());\n\t}\n\n\t// ------------- imperative API -------------\n\n\tpublic dispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\n\t\t// Drain any tasks queued during a never-finished commit so callers'\n\t\t// promises resolve to `false` instead of leaking.\n\t\tfor (const task of this.pendingPostInitTasks.splice(0)) task.resolve(false);\n\n\t\t// `committed` may be true while `initialized` is still false if dispose\n\t\t// fires while `commitRegistration()` is awaiting the initializer chain\n\t\t// (React 19 Strict Mode double-mount triggers this).\n\t\tconst lastTree = this.initialized ? this.store.getTreeSnapshot() : null;\n\t\tfor (const listener of this.listeners) {\n\t\t\ttry {\n\t\t\t\tlistener.onDestroy(lastTree as Readonly<IWizardTreeState<Step, Category, Branch>>);\n\t\t\t} catch (e) {\n\t\t\t\tthis.log.error(e);\n\t\t\t}\n\t\t}\n\n\t\tthis.navService.dispose();\n\t\tthis.store.dispose();\n\t\tthis.config.dispose();\n\t}\n\n\tpublic exitWizard(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.exitWizard());\n\t}\n\n\tpublic getTreeSnapshot = (): Readonly<IWizardTreeState<Step, Category, Branch>> => this.store.getTreeSnapshot();\n\n\tpublic go(tree: Readonly<IWizardTreeState<Step, Category, Branch>>): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(tree));\n\t}\n\n\tpublic goToCategory(category: Category): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.goToCategory(category)));\n\t}\n\n\tpublic hideCategory(category: Category): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.hideCategory(category));\n\t}\n\n\tpublic hideStep(step: Step | Step[]): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.hideStep(step));\n\t}\n\n\tpublic isStepVisible(stepId: Step): boolean {\n\t\tconst tree = this.store.getTreeSnapshot();\n\t\tconst step = tree.stepMap[stepId];\n\t\tif (!step) return false;\n\t\treturn this.visibilityStrategy.isStepVisible(step, tree);\n\t}\n\n\tpublic next(branch?: Branch | null): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.next(branch ?? null)));\n\t}\n\n\tpublic nextCategory(branch?: Branch | null): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.nextCategory(branch ?? null)));\n\t}\n\n\tpublic on(\n\t\ttype: '*' | WizardEvent<Step, Category, Branch>['type'],\n\t\thandler: (event: WizardEvent<Step, Category, Branch>) => void\n\t): () => void {\n\t\treturn this.navService.on(type, handler);\n\t}\n\n\tpublic resetActiveCategory(from = 0): Promise<boolean> {\n\t\treturn this.runOrQueue(() =>\n\t\t\tthis.navService.navigate(this.stateService.resetCategory(this.tree.activeCategory.id, from))\n\t\t);\n\t}\n\n\tpublic resetCategory(category: Category, from = 0): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.resetCategory(category, from)));\n\t}\n\n\tpublic resetWizard(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.resetTree()));\n\t}\n\n\tpublic scrollToTop(behavior: 'auto' | 'smooth' = 'smooth'): Promise<boolean> {\n\t\treturn this.scrollStrategy.scrollToTop(behavior);\n\t}\n\n\tpublic showCategory(category: Category): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.showCategory(category));\n\t}\n\n\tpublic showStep(step: Step | Step[]): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.showStep(step));\n\t}\n\n\tpublic skipActiveCategory(): Promise<boolean> {\n\t\treturn this.runOrQueue(() =>\n\t\t\tthis.navService.navigate(this.stateService.skipCategory(this.tree.activeCategory.id))\n\t\t);\n\t}\n\n\tpublic skipCategory(category?: Category): Promise<boolean> {\n\t\treturn this.runOrQueue(() =>\n\t\t\tthis.navService.navigate(this.stateService.skipCategory(category ?? this.tree.activeCategory.id))\n\t\t);\n\t}\n\n\tpublic subscribe = (listener: () => void): (() => void) => this.store.subscribe(listener);\n\n\tpublic toggleCategory(category: Category, show: boolean): Promise<boolean> {\n\t\treturn show ? this.showCategory(category) : this.hideCategory(category);\n\t}\n\n\t// ------------- lifecycle -------------\n\n\tpublic toggleStep(step: Step | Step[], show: boolean): Promise<boolean> {\n\t\treturn show ? this.showStep(step) : this.hideStep(step);\n\t}\n\n\t// ------------- internal -------------\n\n\tprivate runOrQueue(action: () => Promise<boolean>): Promise<boolean> {\n\t\tif (this.disposed) {\n\t\t\treturn Promise.resolve(false);\n\t\t}\n\t\t// Queue until the store is actually populated — `committed` flips to true\n\t\t// synchronously inside `commitRegistration` but `initialized` only flips\n\t\t// after the initializer chain settles.\n\t\tif (!this.initialized) {\n\t\t\treturn new Promise<boolean>((resolve, reject) => {\n\t\t\t\tthis.pendingPostInitTasks.push({\n\t\t\t\t\tresolve,\n\t\t\t\t\trun: () => {\n\t\t\t\t\t\taction().then(resolve, reject);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t\treturn action();\n\t}\n}\n","export enum WizardCategoryDirection {\n\tBackward = 'backward',\n\tForward = 'forward',\n}\n","'use client';\n\nimport { type ComponentType, createContext, type ReactNode, useContext } from 'react';\n\nexport interface IWizardButtonProps {\n\tasChild?: boolean;\n\tchildren?: ReactNode;\n\tclassName?: string;\n\tdisabled?: boolean;\n\tonClick?: () => void;\n\ttype?: 'button' | 'submit';\n\tvariant?: 'default' | 'ghost';\n\tsize?: 'default' | 'icon-sm';\n\t'aria-label'?: string;\n}\n\nexport interface IWizardBackArrowIconProps {\n\tclassName?: string;\n}\n\nexport interface IWizardComponents {\n\tButton: ComponentType<IWizardButtonProps>;\n\tBackArrowIcon: ComponentType<IWizardBackArrowIconProps>;\n}\n\nconst FallbackButton: ComponentType<IWizardButtonProps> = (props) => {\n\tconst { children, asChild: _asChild, variant: _variant, size: _size, ...rest } = props;\n\treturn (\n\t\t<button {...rest} type={props.type ?? 'button'}>\n\t\t\t{children}\n\t\t</button>\n\t);\n};\n\nconst FallbackBackArrowIcon: ComponentType<IWizardBackArrowIconProps> = ({ className }) => (\n\t<svg className={className} width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden>\n\t\t<path d=\"M10 4 L6 8 L10 12\" stroke=\"currentColor\" strokeWidth=\"1.5\" fill=\"none\" />\n\t</svg>\n);\n\nconst defaults: IWizardComponents = { Button: FallbackButton, BackArrowIcon: FallbackBackArrowIcon };\n\nconst WizardComponentsContext = createContext<IWizardComponents>(defaults);\n\nexport function WizardComponentsProvider(props: {\n\tButton?: ComponentType<IWizardButtonProps>;\n\tBackArrowIcon?: ComponentType<IWizardBackArrowIconProps>;\n\tchildren: ReactNode;\n}) {\n\tconst { Button, BackArrowIcon, children } = props;\n\tconst value: IWizardComponents = {\n\t\tButton: Button ?? defaults.Button,\n\t\tBackArrowIcon: BackArrowIcon ?? defaults.BackArrowIcon,\n\t};\n\treturn <WizardComponentsContext.Provider value={value}>{children}</WizardComponentsContext.Provider>;\n}\n\nexport function useWizardComponents(): IWizardComponents {\n\treturn useContext(WizardComponentsContext);\n}\n","'use client';\n\nimport { useContext, useSyncExternalStore } from 'react';\n\nimport type { WizardEngine } from '../core/wizard-engine';\n\nimport { WizardError } from '../core/errors';\nimport { WizardEngineContext } from './context';\n\n/**\n * Returns the active `WizardEngine` instance and re-renders the consumer on\n * every tree change. Throws if used outside a `<WizardProvider>`.\n *\n * Engine identity is stable across renders.\n */\nexport function useWizard<Step extends string, Category extends string, Branch extends string = string>(): WizardEngine<\n\tStep,\n\tCategory,\n\tBranch\n> {\n\tconst engine = useContext(WizardEngineContext) as null | WizardEngine<Step, Category, Branch>;\n\tif (!engine) {\n\t\tthrow new WizardError('useWizard must be used inside <WizardProvider>');\n\t}\n\tuseSyncExternalStore(engine.subscribe, engine.getTreeSnapshot, engine.getTreeSnapshot);\n\treturn engine;\n}\n","'use client';\n\nimport { createContext } from 'react';\n\nimport type { WizardEngine } from '../core/wizard-engine';\n\n/**\n * React context exposing the active `WizardEngine` instance to descendants.\n * `null` outside a `<WizardProvider>` — `useWizard()` throws a clear error.\n */\nexport const WizardEngineContext = createContext<null | WizardEngine<string, string, string>>(null);\n","'use client';\n\nimport { Slot } from '@radix-ui/react-slot';\nimport { type ReactNode } from 'react';\n\nimport { type IWizardButtonProps, useWizardComponents } from '../components-provider';\n\ninterface IWizardActionButtonProps {\n\tasChild?: boolean;\n\tchildren?: ReactNode;\n\tclassName?: string;\n\tdefaultLabel: ReactNode;\n\tonClick: () => void;\n\tvariant?: IWizardButtonProps['variant'];\n}\n\n/**\n * Internal scaffold shared by `WizardBack` and `WizardNext`. Renders the\n * Button injected via `WizardComponentsProvider`, or wraps children in a\n * Radix `Slot` when `asChild` is set so the consumer's element receives\n * the click + className.\n */\nexport function WizardActionButton(props: IWizardActionButtonProps) {\n\tconst { Button } = useWizardComponents();\n\n\tif (props.asChild) {\n\t\treturn (\n\t\t\t<Slot className={props.className} onClick={props.onClick}>\n\t\t\t\t{props.children}\n\t\t\t</Slot>\n\t\t);\n\t}\n\treturn (\n\t\t<Button className={props.className} onClick={props.onClick} type=\"button\" variant={props.variant}>\n\t\t\t{props.children ?? props.defaultLabel}\n\t\t</Button>\n\t);\n}\n","'use client';\n\nimport { type ReactNode } from 'react';\n\nimport { useWizard } from '../use-wizard';\nimport { WizardActionButton } from './wizard-action-button';\n\ninterface IWizardBackComponentProps {\n\tasChild?: boolean;\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\n/**\n * Back button. Calls `wizard.back()` on click. Wrap a custom button via\n * `asChild` to compose with shadcn variants.\n */\nexport function WizardBack(props: IWizardBackComponentProps) {\n\tconst wizard = useWizard();\n\treturn (\n\t\t<WizardActionButton\n\t\t\tasChild={props.asChild}\n\t\t\tclassName={props.className}\n\t\t\tdefaultLabel={wizard.configOptions.backBtnText ?? 'Back'}\n\t\t\tonClick={() => void wizard.back()}\n\t\t\tvariant=\"ghost\"\n\t\t>\n\t\t\t{props.children}\n\t\t</WizardActionButton>\n\t);\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\n\nimport { useWizard } from '../use-wizard';\n\ninterface IWizardCategoryComponentProps<Category extends string> {\n\tcategoryId: Category;\n\tchildren: ReactNode;\n}\n\n/**\n * Wrapper that renders its children only while the named category is active.\n */\nexport function WizardCategory<Category extends string>(props: IWizardCategoryComponentProps<Category>) {\n\tconst wizard = useWizard<string, Category>();\n\tif (wizard.tree.activeCategory.id !== props.categoryId) return null;\n\treturn <>{props.children}</>;\n}\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(...inputs));\n}\n","'use client';\n\nimport { cn } from '~/utils/cn';\nimport { CheckIcon } from 'lucide-react';\n\nexport type WizardStepperDotState = 'active' | 'completed' | 'pending' | 'skipped';\n\ninterface IWizardStepperDotProps {\n\tclickable?: boolean;\n\tisLast?: boolean;\n\tlabel?: string;\n\tonClick?: () => void;\n\tprogress: number;\n\tstate: WizardStepperDotState;\n}\n\n/**\n * Single dot in `WizardStepper`. Renders a 12px circle with a trailing track\n * fill (sized by `progress` 0-100) unless `isLast`. Optional label sits above.\n *\n * Visual states map to project semantic status tokens\n * (`success-bg`, `success-text`, `success-border`, `border`, `muted-foreground`).\n */\nexport function WizardStepperDot(props: IWizardStepperDotProps) {\n\tconst { clickable = false, isLast = false, label, onClick, progress, state } = props;\n\tconst isInteractive = clickable && !!onClick;\n\n\treturn (\n\t\t<li className=\"relative flex flex-1 items-center\" data-state={state}>\n\t\t\t<button\n\t\t\t\taria-current={state === 'active' ? 'step' : undefined}\n\t\t\t\taria-label={label ?? state}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'relative flex size-3 shrink-0 items-center justify-center rounded-full border-2 transition-colors',\n\t\t\t\t\tstate === 'pending' && 'border-border bg-background',\n\t\t\t\t\tstate === 'active' &&\n\t\t\t\t\t\t'border-success-text bg-success-text ring-2 ring-success-border/40 ring-offset-2 ring-offset-background',\n\t\t\t\t\tstate === 'completed' && 'border-success-border bg-success-text',\n\t\t\t\t\tstate === 'skipped' && 'border-border bg-background opacity-60',\n\t\t\t\t\tisInteractive && 'cursor-pointer hover:bg-success-bg',\n\t\t\t\t\t!isInteractive && 'cursor-default'\n\t\t\t\t)}\n\t\t\t\tdisabled={!isInteractive}\n\t\t\t\tonClick={isInteractive ? onClick : undefined}\n\t\t\t\ttype=\"button\"\n\t\t\t>\n\t\t\t\t{state === 'completed' && <CheckIcon className=\"size-2 text-background\" />}\n\t\t\t</button>\n\t\t\t{!isLast && (\n\t\t\t\t<span aria-hidden className=\"relative ml-1 mr-1 h-px flex-1 bg-border\">\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"absolute inset-y-0 left-0 bg-success-border transition-[width]\"\n\t\t\t\t\t\tstyle={{ width: `${Math.max(0, Math.min(100, progress))}%` }}\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t{label && (\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'absolute -top-6 left-0 -translate-x-[calc(50%-0.375rem)] text-sm font-semibold whitespace-nowrap',\n\t\t\t\t\t\tstate === 'active' && 'text-success-text',\n\t\t\t\t\t\tstate !== 'active' && 'text-muted-foreground'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</li>\n\t);\n}\n","'use client';\n\nimport type { IWizardCategoryState } from '../../core/state';\n\nimport { WizardStepperDot, type WizardStepperDotState } from './wizard-stepper-dot';\n\ninterface IWizardStepperProps<Category extends string> {\n\tcanAccessCategory?: (category: IWizardCategoryState<string, Category, string>) => boolean;\n\tcategories: ReadonlyArray<IWizardCategoryState<string, Category, string>>;\n\tdoneDot?: { text: string };\n\theaderI18n?: null | Record<Category, string>;\n\tonCategoryClick?: (category: IWizardCategoryState<string, Category, string>) => void;\n\tprogress: Record<Category, number>;\n}\n\n/**\n * Pure-presentational horizontal stepper. Renders one `WizardStepperDot` per\n * category with the per-category progress fill on the trailing track, plus an\n * optional trailing \"done\" dot.\n */\nexport function WizardStepper<Category extends string>(props: IWizardStepperProps<Category>) {\n\tconst { canAccessCategory, categories, doneDot, headerI18n, onCategoryClick, progress } = props;\n\tconst lastIdx = categories.length - 1;\n\n\treturn (\n\t\t<ol aria-label=\"Wizard progress\" className=\"relative flex flex-1 items-center pt-6\">\n\t\t\t{categories.map((category, idx) => {\n\t\t\t\tconst isLast = idx === lastIdx && !doneDot;\n\t\t\t\tconst clickable = canAccessCategory?.(category) ?? false;\n\t\t\t\treturn (\n\t\t\t\t\t<WizardStepperDot\n\t\t\t\t\t\tclickable={clickable}\n\t\t\t\t\t\tisLast={isLast}\n\t\t\t\t\t\tkey={category.id}\n\t\t\t\t\t\tlabel={headerI18n?.[category.id]}\n\t\t\t\t\t\tonClick={onCategoryClick ? () => onCategoryClick(category) : undefined}\n\t\t\t\t\t\tprogress={progress[category.id] ?? 0}\n\t\t\t\t\t\tstate={getDotState(category, progress[category.id] ?? 0)}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t})}\n\t\t\t{doneDot && <WizardStepperDot isLast label={doneDot.text} progress={0} state=\"pending\" />}\n\t\t</ol>\n\t);\n}\n\nfunction getDotState(category: IWizardCategoryState<string, string, string>, progress: number): WizardStepperDotState {\n\tif (category.isActive) return 'active';\n\tif (progress >= 100) return 'completed';\n\tif (category.isSkipped) return 'skipped';\n\treturn 'pending';\n}\n","'use client';\n\nimport { cn } from '~/utils/cn';\n\nimport type { IWizardCategoryState } from '../../core/state';\n\nimport { useWizard } from '../use-wizard';\nimport { WizardBack } from './wizard-back';\nimport { WizardStepper } from './wizard-stepper';\n\n/**\n * Default wizard header — renders an optional back button and the visual\n * stepper. Gates on `config.isShowWizardHeader`, reserves space when the back\n * button is hidden, and forwards click handlers that delegate to\n * `wizard.goToCategory` / `wizard.resetCategory`.\n */\nexport function WizardHeader<Category extends string = string>() {\n\tconst wizard = useWizard<string, Category>();\n\tconst tree = wizard.tree;\n\tconst config = wizard.configOptions;\n\n\tif (!config.isShowWizardHeader) return null;\n\n\t/**\n\t * Per-step header overrides (`isShowBackBtn`, `isShowHeaderSteps` from the\n\t * Angular original) are not part of the React port yet. Both default to true.\n\t */\n\tconst oneCategory = tree.activeBranch.shownCategories.length === 1 && !config.isDoneDot;\n\tconst stepHeaderEnabled = true;\n\tconst showSteps = config.isShowWizardHeaderSteps && stepHeaderEnabled && !oneCategory;\n\n\tconst canAccessCategory = (category: IWizardCategoryState<string, Category, string>): boolean => {\n\t\tif (config.isBackResetCompleted) return false;\n\t\tif (category.isCompleted) return true;\n\t\tconst idx = tree.activeBranch.shownCategories.indexOf(category);\n\t\treturn !!tree.activeBranch.shownCategories[idx - 1]?.isCompleted;\n\t};\n\n\tconst onCategoryClick = (category: IWizardCategoryState<string, Category, string>) => {\n\t\tif (config.isBackResetCompleted) return;\n\t\tconst isCategoryStart = category.activeSteps.length === 1;\n\t\tif (config.isActiveCategoryClickReset && category.isActive && !isCategoryStart) {\n\t\t\tvoid wizard.resetCategory(category.id);\n\t\t\treturn;\n\t\t}\n\t\tif (!category.isActive && category.isCompleted) {\n\t\t\tvoid wizard.goToCategory(category.id);\n\t\t\treturn;\n\t\t}\n\t\tif (!category.isActive && canAccessCategory(category)) {\n\t\t\tvoid wizard.goToCategory(category.id);\n\t\t}\n\t};\n\n\treturn (\n\t\t<header\n\t\t\tclassName={cn(\n\t\t\t\t'relative mb-8 flex items-center gap-4 border-b border-border bg-background px-4 py-3',\n\t\t\t\tconfig.stickyHeader && 'sticky top-0 z-10'\n\t\t\t)}\n\t\t>\n\t\t\t<WizardBack />\n\t\t\t{showSteps && (\n\t\t\t\t<WizardStepper<Category>\n\t\t\t\t\tcanAccessCategory={canAccessCategory}\n\t\t\t\t\tcategories={tree.activeBranch.shownCategories}\n\t\t\t\t\tdoneDot={config.isDoneDot ? { text: config.doneDotText } : undefined}\n\t\t\t\t\theaderI18n={config.headerI18n}\n\t\t\t\t\tonCategoryClick={onCategoryClick}\n\t\t\t\t\tprogress={wizard.progress}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</header>\n\t);\n}\n","'use client';\n\nimport { type ReactNode } from 'react';\n\nimport { useWizard } from '../use-wizard';\nimport { WizardActionButton } from './wizard-action-button';\n\ninterface IWizardNextComponentProps {\n\tasChild?: boolean;\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\n/**\n * Next button. Calls `wizard.next()` on click. Use `asChild` to compose with a\n * custom button.\n *\n * The default label is contextual:\n * - `nextBtnText` (default \"Next\") within a category\n * - `nextCategoryText` (default \"Continue\") on the last step of a non-final category\n * - `finishText` (default \"Finish\") on the last step of the last category\n */\nexport function WizardNext(props: IWizardNextComponentProps) {\n\tconst wizard = useWizard();\n\t// Skip label compute when caller provides their own children/asChild.\n\tconst defaultLabel = !props.asChild && props.children === undefined ? getNextLabel(wizard) : '';\n\treturn (\n\t\t<WizardActionButton\n\t\t\tasChild={props.asChild}\n\t\t\tclassName={props.className}\n\t\t\tdefaultLabel={defaultLabel}\n\t\t\tonClick={() => void wizard.next()}\n\t\t>\n\t\t\t{props.children}\n\t\t</WizardActionButton>\n\t);\n}\n\nfunction getNextLabel(wizard: ReturnType<typeof useWizard>): string {\n\tconst config = wizard.configOptions;\n\tconst tree = wizard.tree;\n\tconst activeStep = tree.lastActiveStep;\n\tconst category = tree.categoryMap[activeStep.categoryId];\n\tconst isLastStep = category.lastStep.id === activeStep.id;\n\tconst isLastCategory = tree.activeBranch.lastCategory.id === category.id;\n\tif (!isLastStep) return config.nextBtnText;\n\treturn isLastCategory ? config.finishText : config.nextCategoryText;\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\n\nimport { cn } from '~/utils/cn';\nimport { CheckIcon } from 'lucide-react';\n\nimport { type IWizardCategoryView, useWizardCategoriesView } from '../hooks/use-wizard-categories-view';\nimport { useWizard } from '../use-wizard';\n\ninterface IWizardRailProps<Step extends string, Category extends string> {\n\tcanAccessCategory?: (category: IWizardCategoryView<Step, Category>) => boolean;\n\tclassName?: string;\n\theaderI18n?: Partial<Record<Category, ReactNode>>;\n\tsubStepLabels?: Partial<Record<Step, ReactNode>>;\n}\n\n/**\n * Vertical category rail for full-page wizard layouts. Renders one button per\n * shown category with dot state, expands the active category to surface its\n * sub-steps when present, and dispatches `wizard.goToCategory` on click.\n *\n * Pure consumer of `useWizard` — no local state.\n */\nexport function WizardRail<Step extends string, Category extends string, Branch extends string = string>(\n\tprops: IWizardRailProps<Step, Category>\n) {\n\tconst { canAccessCategory, className, headerI18n, subStepLabels } = props;\n\tconst wizard = useWizard<Step, Category, Branch>();\n\tconst view = useWizardCategoriesView<Step, Category, Branch>();\n\tconst labels = headerI18n ?? (wizard.configOptions.headerI18n as Partial<Record<Category, ReactNode>> | undefined);\n\n\tconst isClickable = (category: IWizardCategoryView<Step, Category>) =>\n\t\tcanAccessCategory?.(category) ?? defaultClickable(category.state);\n\n\treturn (\n\t\t<nav aria-label=\"Wizard steps\" className={cn('flex flex-col gap-1', className)}>\n\t\t\t<ol className=\"relative flex flex-col gap-1\">\n\t\t\t\t{view.map((category, idx) => {\n\t\t\t\t\tconst label = labels?.[category.id] ?? String(category.id);\n\t\t\t\t\tconst clickable = isClickable(category);\n\t\t\t\t\tconst isLast = idx === view.length - 1;\n\t\t\t\t\tconst isPassed = category.state === 'completed' || category.state === 'skipped';\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li className=\"relative\" key={category.id}>\n\t\t\t\t\t\t\t{!isLast && (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t'pointer-events-none absolute top-7 -bottom-2 left-5 w-px -translate-x-1/2 transition-colors duration-200',\n\t\t\t\t\t\t\t\t\t\tisPassed ? 'bg-success-border' : 'bg-border'\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\taria-current={category.isActive ? 'step' : undefined}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm font-medium transition-[color,background-color,transform] duration-200 ease-(--ease-out-strong)',\n\t\t\t\t\t\t\t\t\tcategory.state === 'active' && 'bg-success-bg/60 text-success-text',\n\t\t\t\t\t\t\t\t\tcategory.state === 'completed' && 'text-foreground',\n\t\t\t\t\t\t\t\t\tcategory.state === 'skipped' && 'text-muted-foreground opacity-70',\n\t\t\t\t\t\t\t\t\tcategory.state === 'pending' && 'text-muted-foreground',\n\t\t\t\t\t\t\t\t\tclickable\n\t\t\t\t\t\t\t\t\t\t? 'cursor-pointer hover:bg-foreground/[0.06] motion-safe:active:scale-[0.97]'\n\t\t\t\t\t\t\t\t\t\t: 'cursor-default'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tdata-state={category.state}\n\t\t\t\t\t\t\t\tdisabled={!clickable}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\tvoid wizard.goToCategory(category.id);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<RailDot state={category.state} />\n\t\t\t\t\t\t\t\t<span>{label}</span>\n\t\t\t\t\t\t\t</button>\n\n\t\t\t\t\t\t\t{category.isActive && category.subSteps.length > 0 && (\n\t\t\t\t\t\t\t\t<ol className=\"mt-1 ml-7 flex flex-col gap-1 border-l border-border pl-3\">\n\t\t\t\t\t\t\t\t\t{category.subSteps.map(step => (\n\t\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\t\taria-current={step.isActive ? 'step' : undefined}\n\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t'rounded px-2 py-1 text-sm',\n\t\t\t\t\t\t\t\t\t\t\t\tstep.isActive\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'text-success-text font-medium'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'text-muted-foreground'\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\tkey={step.id}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{subStepLabels?.[step.id] ?? String(step.id)}\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</ol>\n\t\t</nav>\n\t);\n}\n\nfunction defaultClickable(state: IWizardCategoryView<string, string>['state']): boolean {\n\treturn state !== 'pending';\n}\n\nfunction RailDot({ state }: { state: IWizardCategoryView<string, string>['state'] }) {\n\treturn (\n\t\t<span\n\t\t\taria-hidden\n\t\t\tclassName={cn(\n\t\t\t\t'flex size-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors',\n\t\t\t\tstate === 'pending' && 'border-border bg-background',\n\t\t\t\tstate === 'active' && 'border-success-border bg-success-bg',\n\t\t\t\tstate === 'completed' && 'border-success-border bg-success-text',\n\t\t\t\tstate === 'skipped' && 'border-border bg-background opacity-60'\n\t\t\t)}\n\t\t>\n\t\t\t{state === 'completed' && (\n\t\t\t\t<CheckIcon className=\"size-2.5 text-background motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-75 motion-safe:duration-200\" />\n\t\t\t)}\n\t\t</span>\n\t);\n}\n","'use client';\n\nimport type { IWizardCategoryState, IWizardStepState } from '../../core/state';\n\nimport { useWizard } from '../use-wizard';\n\nexport interface IWizardCategoryView<Step extends string, Category extends string> {\n\tid: Category;\n\tisActive: boolean;\n\tstate: WizardCategoryViewState;\n\tsubSteps: ReadonlyArray<{ id: Step; isActive: boolean }>;\n}\n\nexport type WizardCategoryViewState = 'active' | 'completed' | 'pending' | 'skipped';\n\nconst EMPTY_SUB_STEPS: ReadonlyArray<{ id: string; isActive: boolean }> = [];\n\n/**\n * Projects the wizard's active branch into a normalized list for navigation\n * surfaces (rail, stepper). Pure projection — re-renders on tree change via\n * `useWizard`.\n */\nexport function useWizardCategoriesView<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n>(): ReadonlyArray<IWizardCategoryView<Step, Category>> {\n\tconst wizard = useWizard<Step, Category, Branch>();\n\treturn wizard.tree.activeBranch.shownCategories.map(category => projectCategory<Step, Category, Branch>(category));\n}\n\nfunction getCategoryState(category: {\n\tisActive: boolean;\n\tisCompleted: boolean;\n\tisSkipped: boolean;\n}): WizardCategoryViewState {\n\tif (category.isActive) return 'active';\n\tif (category.isCompleted) return 'completed';\n\tif (category.isSkipped) return 'skipped';\n\treturn 'pending';\n}\n\nfunction projectCategory<Step extends string, Category extends string, Branch extends string>(\n\tcategory: IWizardCategoryState<Step, Category, Branch>\n): IWizardCategoryView<Step, Category> {\n\tconst shown = category.shownSteps;\n\tconst subSteps =\n\t\tshown.length > 1\n\t\t\t? shown\n\t\t\t\t\t.slice()\n\t\t\t\t\t.sort((a, b) => a.htmlIndex - b.htmlIndex)\n\t\t\t\t\t.map((step: IWizardStepState<Step, Category, Branch>) => ({ id: step.id, isActive: step.isActive }))\n\t\t\t: (EMPTY_SUB_STEPS as ReadonlyArray<{ id: Step; isActive: boolean }>);\n\n\treturn {\n\t\tid: category.id,\n\t\tisActive: category.isActive,\n\t\tstate: getCategoryState(category),\n\t\tsubSteps,\n\t};\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\n\nimport { useCallback, useContext, useSyncExternalStore } from 'react';\n\nimport type { WizardEngine } from '../../core/wizard-engine';\n\nimport { WizardError } from '../../core/errors';\nimport { WizardEngineContext } from '../context';\n\ninterface IWizardStepComponentProps<Step extends string> {\n\tchildren: ReactNode;\n\tid: Step;\n}\n\n/**\n * Renders children only when the active visibility strategy reports the step\n * as visible. Delegates to `WizardEngine.isStepVisible(id)` so swapping the\n * strategy via `withVisibilityStrategy(...)` actually changes mount behavior.\n */\nexport function WizardStep<Step extends string>(props: IWizardStepComponentProps<Step>) {\n\tconst engine = useContext(WizardEngineContext) as null | WizardEngine<Step, string, string>;\n\tif (!engine) {\n\t\tthrow new WizardError('WizardStep must be used inside <WizardProvider>');\n\t}\n\n\tconst getSnapshot = useCallback(() => engine.isStepVisible(props.id), [engine, props.id]);\n\tconst isVisible = useSyncExternalStore(engine.subscribe, getSnapshot, getSnapshot);\n\n\tif (!isVisible) return null;\n\treturn (\n\t\t<div\n\t\t\tclassName=\"motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-1 motion-safe:duration-300 motion-safe:ease-(--ease-out-strong)\"\n\t\t\tid={props.id}\n\t\t>\n\t\t\t{props.children}\n\t\t</div>\n\t);\n}\n","'use client';\n\nimport { type ReactNode, useEffect, useState } from 'react';\n\nimport type { IWizardProviderProps } from '../core/compose-wizard-providers';\nimport type { IWizardStepState } from '../core/state';\n\nimport { WizardEngine, type WizardEngineOptions } from '../core/wizard-engine';\nimport { WizardEngineContext } from './context';\n\ninterface IWizardProviderComponentProps<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends Partial<IWizardProviderProps<Step, Category, Branch>> {\n\tactiveBranch?: Branch;\n\tchildren: ReactNode;\n\tstate: ReadonlyArray<IWizardStepState<Step, Category, Branch>>;\n}\n\n/**\n * Top-level wizard provider. Captures the boot options once via lazy\n * `useState`, then constructs a fresh `WizardEngine` inside an effect so React\n * 19 Strict Mode's mount/unmount/remount cycle does not leave a permanently\n * disposed engine in shared state. The engine is disposed on unmount.\n *\n * Idiomatic shape:\n * ```tsx\n * <WizardProvider state={...} {...composeWizardProviders(withConfig(...))}>\n * <WizardLayout>...</WizardLayout>\n * </WizardProvider>\n * ```\n */\nexport function WizardProvider<Step extends string, Category extends string, Branch extends string = string>(\n\tprops: IWizardProviderComponentProps<Step, Category, Branch>\n) {\n\tconst { activeBranch, children, config, initializers, listeners, scrollContainer, state, strategies } = props;\n\n\tconst [bootOptions] = useState<WizardEngineOptions<Step, Category, Branch>>(() => ({\n\t\tactiveBranch,\n\t\tconfig,\n\t\tinitializers,\n\t\tlisteners,\n\t\tscrollContainer,\n\t\tstate,\n\t\tstrategies,\n\t}));\n\n\tconst [engine, setEngine] = useState<null | WizardEngine<Step, Category, Branch>>(null);\n\n\tuseEffect(() => {\n\t\tconst newEngine = new WizardEngine<Step, Category, Branch>(bootOptions);\n\n\t\tlet cancelled = false;\n\t\tnewEngine.commitRegistration().then(() => {\n\t\t\tif (!cancelled) setEngine(newEngine);\n\t\t});\n\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t\tnewEngine.dispose();\n\t\t\tsetEngine(prev => (prev === newEngine ? null : prev));\n\t\t};\n\t}, [bootOptions]);\n\n\tif (!engine) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<WizardEngineContext.Provider value={engine as unknown as WizardEngine<string, string, string>}>\n\t\t\t{children}\n\t\t</WizardEngineContext.Provider>\n\t);\n}\n","'use client';\n\nimport { type RefObject, useEffect, useRef } from 'react';\n\nimport type { WizardEngine } from '../core/wizard-engine';\n\nimport { useWizard } from './use-wizard';\n\ninterface IWizardEngineRefCaptureProps<Step extends string, Category extends string> {\n\tengineRef: RefObject<null | WizardEngine<Step, Category>>;\n}\n\n/**\n * Holds a ref to the live `WizardEngine`. Place `<WizardEngineRefCapture\n * engineRef={ref} />` inside `<WizardProvider>` so a form's submit handler\n * (which sits outside the provider) can navigate the wizard programmatically.\n */\nexport function useWizardEngineRef<Step extends string, Category extends string>(): RefObject<null | WizardEngine<\n\tStep,\n\tCategory\n>> {\n\treturn useRef<null | WizardEngine<Step, Category>>(null);\n}\n\nexport function WizardEngineRefCapture<Step extends string, Category extends string>({\n\tengineRef,\n}: IWizardEngineRefCaptureProps<Step, Category>): null {\n\tconst wizard = useWizard<Step, Category>();\n\tuseEffect(() => {\n\t\tengineRef.current = wizard;\n\t\treturn () => {\n\t\t\tengineRef.current = null;\n\t\t};\n\t}, [engineRef, wizard]);\n\treturn null;\n}\n","'use client';\n\nimport { useContext, useEffect, useRef } from 'react';\n\nimport type { WizardEvent } from '../core/events/wizard-events';\nimport type { WizardEngine } from '../core/wizard-engine';\n\nimport { WizardError } from '../core/errors';\nimport { WizardEngineContext } from './context';\n\ntype WildcardOrType<E extends { type: string }> = '*' | E['type'];\n\n/**\n * Subscribe to a wizard event type (or all events with `'*'`). The handler is\n * stored in a ref so updating it across renders doesn't resubscribe — the\n * subscription is bound to the type only.\n */\nexport function useWizardEvent<Step extends string, Category extends string, Branch extends string = string>(\n\ttype: WildcardOrType<WizardEvent<Step, Category, Branch>>,\n\thandler: (event: WizardEvent<Step, Category, Branch>) => void\n): void {\n\tconst engine = useContext(WizardEngineContext) as null | WizardEngine<Step, Category, Branch>;\n\tif (!engine) {\n\t\tthrow new WizardError('useWizardEvent must be used inside <WizardProvider>');\n\t}\n\n\tconst handlerRef = useRef(handler);\n\n\tuseEffect(() => {\n\t\thandlerRef.current = handler;\n\t});\n\n\tuseEffect(() => {\n\t\treturn engine.on(type, event => handlerRef.current(event));\n\t}, [engine, type]);\n}\n","'use client';\n\nimport { useCallback, useContext, useRef, useSyncExternalStore } from 'react';\n\nimport type { IWizardStepState } from '../core/state';\nimport type { WizardEngine } from '../core/wizard-engine';\n\nimport { WizardError } from '../core/errors';\nimport { WizardEngineContext } from './context';\n\n/**\n * Subscribe to a single step's state. Re-renders only when this step's slice\n * changes (compared by `Object.is` on each flag). Returns the step state, or\n * `null` if the engine doesn't know about this id.\n */\nexport function useWizardStep<Step extends string, Category extends string = string, Branch extends string = string>(\n\tstepId: Step\n): IWizardStepState<Step, Category, Branch> | null {\n\tconst engine = useContext(WizardEngineContext) as null | WizardEngine<Step, Category, Branch>;\n\tif (!engine) {\n\t\tthrow new WizardError('useWizardStep must be used inside <WizardProvider>');\n\t}\n\n\tconst lastRef = useRef<IWizardStepState<Step, Category, Branch> | null>(null);\n\n\tconst getSnapshot = useCallback((): IWizardStepState<Step, Category, Branch> | null => {\n\t\tconst tree = engine.getTreeSnapshot();\n\t\tconst next = tree.stepMap[stepId] ?? null;\n\t\tconst prev = lastRef.current;\n\n\t\t// Stable-reference cache so consumers don't re-render unless flags change\n\t\tif (\n\t\t\tprev !== null &&\n\t\t\tnext !== null &&\n\t\t\tprev.isActive === next.isActive &&\n\t\t\tprev.isShow === next.isShow &&\n\t\t\tprev.isCompleted === next.isCompleted &&\n\t\t\tprev.isSkipped === next.isSkipped\n\t\t) {\n\t\t\treturn prev;\n\t\t}\n\n\t\tlastRef.current = next;\n\t\treturn next;\n\t}, [engine, stepId]);\n\n\treturn useSyncExternalStore(engine.subscribe, getSnapshot, getSnapshot);\n}\n"],"mappings":";;;AAAO,IAAK,kBAAL,kBAAKA,qBAAL;AACN,EAAAA,iBAAA,cAAW;AACX,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,yBAAsB;AACtB,EAAAA,iBAAA,mBAAgB;AAChB,EAAAA,iBAAA,qBAAkB;AAClB,EAAAA,iBAAA,uBAAoB;AACpB,EAAAA,iBAAA,qBAAkB;AAElB,EAAAA,iBAAA,gBAAa;AACb,EAAAA,iBAAA,kBAAe;AAEf,EAAAA,iBAAA,eAAY;AACZ,EAAAA,iBAAA,iBAAc;AAEd,EAAAA,iBAAA,cAAW;AACX,EAAAA,iBAAA,cAAW;AAhBA,SAAAA;AAAA,GAAA;;;ACAL,IAAM,OAAO,CAAI,QAA4B,IAAI,IAAI,SAAS,CAAC;;;ACA/D,IAAM,UAAU,CAAI,QAAuB,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;;;ACG1E,IAAM,YAAY,CAAC,cAAwD;AACjF,QAAM,aAAa,UAAU,SAAS,KAAK,GAAG;AAE9C,SAAO,GAAG,UAAU,SAAS,IAAI,UAAU,IAAI,UAAU,UAAU,IAAI,UAAU,EAAE;AACpF;AAKO,IAAM,iBAAi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,QACT,KAAK,aAAa,KAAK,YACvB,KAAK,WAAW,KAAK,UACrB,KAAK,gBAAgB,KAAK,eAC1B,KAAK,cAAc,KAAK,WACvB;AACD,aAAO;AAAA,IACR;AAEA,YAAQ,UAAU;AAClB,WAAO;AAAA,EACR,GAAG,CAAC,QAAQ,MAAM,CAAC;AAEnB,SAAOC,sBAAqB,OAAO,WAAW,aAAa,WAAW;AACvE;","names":["WizardEventType","WizardCategoryDirection","useContext","createContext","useContext","jsx","jsx","jsx","jsx","jsx","jsxs","jsx","jsxs","jsx","CheckIcon","jsx","jsxs","CheckIcon","useContext","useSyncExternalStore","jsx","useContext","useSyncExternalStore","jsx","useEffect","useEffect","useContext","useEffect","useRef","useContext","useRef","useEffect","useCallback","useContext","useRef","useSyncExternalStore","useContext","useRef","useCallback","useSyncExternalStore"]}
|
|
1
|
+
{"version":3,"sources":["../src/enums/wizard-event-type.enum.ts","../src/core/utils/general/last.ts","../src/core/utils/general/to-array.ts","../src/core/utils/state/get-step-id.ts","../src/core/utils/state/get-shape-id.ts","../src/core/utils/state/get-state-id.ts","../src/core/builders/build-tree-state.ts","../src/core/builders/wizard-default.const.ts","../src/core/rules/wizard-rule.ts","../src/core/rules/wizard-active-step.rule.ts","../src/core/rules/wizard-passed-prev-categories.rule.ts","../src/core/rules/wizard-passed-prev-steps.rule.ts","../src/core/rules/wizard-shown-active-category.rule.ts","../src/core/rules/wizard-single-active-category.rule.ts","../src/core/rules/wizard-rules.ts","../src/core/state/wizard-tree.state.ts","../src/core/state/project-to-tree.ts","../src/core/builders/wizard-tree-state.builder.ts","../src/core/compose-wizard-providers.ts","../src/core/events/wizard-events.ts","../src/core/initializers/wizard-initializer.ts","../src/core/initializers/wizard-default.initializer.ts","../src/core/listeners/wizard-listener.ts","../src/core/navigation/initializer-service.ts","../src/core/navigation/typed-emitter.ts","../src/core/navigation/wizard-navigation.ts","../src/core/navigation/navigation-service.ts","../src/core/navigation/state-service.ts","../src/core/strategies/progress/wizard-progress.strategy.ts","../src/core/strategies/progress/wizard-active-progress.strategy.ts","../src/core/strategies/scroll/wizard-scroll.strategy.ts","../src/core/strategies/scroll/wizard-smooth-scroll.strategy.ts","../src/core/strategies/visibility/wizard-visibility.strategy.ts","../src/core/strategies/visibility/wizard-default-visibility.strategy.ts","../src/core/strategies/visibility/wizard-last-active-visibility.strategy.ts","../src/core/wizard-default.config.ts","../src/core/wizard-config.ts","../src/core/wizard-log.ts","../src/core/wizard-store.ts","../src/core/wizard-engine.ts","../src/enums/wizard-category-direction.enum.ts","../src/react/components/wizard-action-button.tsx","../src/react/components/wizard-back.tsx","../src/react/components/wizard-category.tsx","../src/react/components/wizard-stepper-dot.tsx","../src/react/components/wizard-stepper.tsx","../src/react/components/wizard-header.tsx","../src/react/components/wizard-next.tsx","../src/react/components/wizard-rail.tsx","../src/react/hooks/use-wizard-categories-view.ts","../src/react/components/wizard-step.tsx","../src/react/provider.tsx","../src/react/use-wizard-engine-ref.ts","../src/react/use-wizard-event.ts","../src/react/use-wizard-step.ts"],"sourcesContent":["export enum WizardEventType {\n\tComplete = 'complete',\n\tExit = 'exit',\n\tNavigationCancelled = 'navigation_cancelled',\n\tNavigationEnd = 'navigation_end',\n\tNavigationError = 'navigation_error',\n\tNavigationIgnored = 'navigation_ignored',\n\tNavigationStart = 'navigation_start',\n\n\tResolveEnd = 'resolve_end',\n\tResolveStart = 'resolve_start',\n\n\tScrollEnd = 'scroll_end',\n\tScrollStart = 'scroll_start',\n\n\tStepHide = 'step_hide',\n\tStepShow = 'step_show',\n}\n","export const last = <T>(arr: T[]): T | undefined => arr[arr.length - 1];\n","export const toArray = <T>(arr: T | T[]): T[] => (Array.isArray(arr) ? arr : [arr]);\n","import type { IWizardEntityState, WizardEntityStateId } from '../../../interfaces/wizard-entity-state.interface';\nimport type { IWizardStepState } from '../../state/wizard-step.state';\n\nexport const getStepId = (stepState: IWizardStepState<string, string>): string => {\n\tconst branchesId = stepState.branches.join(',');\n\n\treturn `${stepState.htmlIndex}:${branchesId}.${stepState.categoryId}.${stepState.id}`;\n};\n\n/**\n * `+isShow, +isCompleted, +isSkipped, +isActive` | for example `1001`\n */\nexport const getStepStateId = (stepState: IWizardEntityState): WizardEntityStateId => {\n\treturn `${+stepState.isShow}${+stepState.isCompleted}${+stepState.isSkipped}${+stepState.isActive}` as WizardEntityStateId;\n};\n","import type { IWizardState } from '../../../interfaces/wizard-step-state-data.interface';\n\nimport { getStepId } from './get-step-id';\n\nexport const getShapeId = (state: IWizardState<string, string>, prefix: number | string = ''): string => {\n\tconst id = state.map(getStepId).join('|');\n\n\treturn prefix !== '' && prefix !== undefined ? `@${prefix}@${id}` : id;\n};\n","import type { IWizardState } from '../../../interfaces/wizard-step-state-data.interface';\n\nimport { getStepStateId } from './get-step-id';\n\nexport const getStateId = (state: IWizardState<string, string>, prefix = ''): string => {\n\tconst id = state.map(getStepStateId).join('|');\n\n\treturn prefix ? `@${prefix}@${id}` : id;\n};\n","import type { IWizardBranchState, IWizardCategoryState, IWizardStepState, IWizardTreeState } from '../state';\n\nimport { getStateId, last } from '../utils';\n\n/**\n * Pure factory for `IWizardBranchState`.\n */\nexport function buildWizardBranchState<Step extends string, Category extends string, Branch extends string = string>(\n\tid: Branch,\n\tcategories: ReadonlyArray<IWizardCategoryState<Step, Category, Branch>>\n): IWizardBranchState<Step, Category, Branch> {\n\tconst shownCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\tconst activeCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\tconst completedCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\tconst skippedCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\tconst passedCategories: Array<IWizardCategoryState<Step, Category, Branch>> = [];\n\n\tfor (const category of categories) {\n\t\tif (category.isActive) activeCategories.push(category);\n\t\tif (category.isShow) shownCategories.push(category);\n\t\tif (category.isCompleted) completedCategories.push(category);\n\t\tif (category.isSkipped) skippedCategories.push(category);\n\t\tif (category.isPassed) passedCategories.push(category);\n\t}\n\n\tconst activeCategory = (activeCategories[0] ?? shownCategories[0]) as IWizardCategoryState<Step, Category, Branch>;\n\n\tconst getShownCategoryIndex = (category: IWizardCategoryState<Step, Category, Branch>): number =>\n\t\tshownCategories.indexOf(category);\n\n\tconst activeCategoryIndex = getShownCategoryIndex(activeCategory);\n\n\tconst firstCategory = shownCategories[0] as IWizardCategoryState<Step, Category, Branch>;\n\tconst lastCategory = last(shownCategories) as IWizardCategoryState<Step, Category, Branch>;\n\tconst prevCategory = activeCategoryIndex > 0 ? (shownCategories[activeCategoryIndex - 1] ?? null) : null;\n\tconst nextCategory = activeCategoryIndex >= 0 ? (shownCategories[activeCategoryIndex + 1] ?? null) : null;\n\n\tconst getShownCategories = (\n\t\tfromIndex: number,\n\t\ttoIndex: number\n\t): Array<IWizardCategoryState<Step, Category, Branch>> => shownCategories.slice(fromIndex, toIndex + 1);\n\n\treturn {\n\t\tactiveCategories,\n\t\tactiveCategory,\n\t\tactiveCategoryIndex,\n\t\tcategories: [...categories],\n\t\tcompletedCategories,\n\t\tfirstCategory,\n\t\tgetShownCategories,\n\t\tgetShownCategoryIndex,\n\t\tid,\n\t\tlastCategory,\n\t\tnextCategory,\n\t\tpassedCategories,\n\t\tprevCategory,\n\t\tshownCategories,\n\t\tskippedCategories,\n\t};\n}\n\n/**\n * Pure factory for `IWizardCategoryState`. Groups steps into shown/active/completed/skipped/passed\n * buckets, then derives all relational fields.\n */\nexport function buildWizardCategoryState<Step extends string, Category extends string, Branch extends string = string>(\n\tid: Category,\n\thtmlIndex: number,\n\tsteps: ReadonlyArray<IWizardStepState<Step, Category, Branch>>\n): IWizardCategoryState<Step, Category, Branch> {\n\tconst branches = steps[0]?.branches ?? [];\n\n\tconst shownSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\tconst activeSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\tconst completedSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\tconst skippedSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\tconst passedSteps: Array<IWizardStepState<Step, Category, Branch>> = [];\n\n\tfor (const step of steps) {\n\t\tif (step.isActive) activeSteps.push(step);\n\t\tif (step.isShow) shownSteps.push(step);\n\t\tif (step.isSkipped) skippedSteps.push(step);\n\t\tif (step.isCompleted) completedSteps.push(step);\n\t\tif (step.isSkipped || step.isCompleted) passedSteps.push(step);\n\t}\n\n\tconst isActive = activeSteps.length > 0;\n\tconst isShow = shownSteps.length > 0;\n\tconst skippedAt = shownSteps.findIndex(step => step.isSkipped);\n\tconst isSkipped = skippedAt !== -1;\n\tconst completedShownSteps = shownSteps.filter(step => step.isCompleted || step.isSkipped);\n\tconst isCompleted = completedShownSteps.length === shownSteps.length && shownSteps.length > 0;\n\tconst isPassed = isCompleted || isSkipped;\n\n\tconst lastActiveStep = last(activeSteps) as IWizardStepState<Step, Category, Branch>;\n\tconst activeStepIndex = lastActiveStep ? shownSteps.indexOf(lastActiveStep) : -1;\n\n\tconst firstStep = shownSteps[0] as IWizardStepState<Step, Category, Branch>;\n\tconst lastStep = last(shownSteps) as IWizardStepState<Step, Category, Branch>;\n\tconst firstActiveStep = activeSteps[0] as IWizardStepState<Step, Category, Branch>;\n\tconst prevStep = activeStepIndex > 0 ? (shownSteps[activeStepIndex - 1] ?? null) : null;\n\tconst nextStep = activeStepIndex >= 0 ? (shownSteps[activeStepIndex + 1] ?? null) : null;\n\n\treturn {\n\t\tactiveStepIndex,\n\t\tactiveSteps,\n\t\tbranches: [...branches],\n\t\tcompletedSteps,\n\t\tfirstActiveStep,\n\t\tfirstStep,\n\t\thtmlIndex,\n\t\tid,\n\t\tisActive,\n\t\tisCompleted,\n\t\tisPassed,\n\t\tisShow,\n\t\tisSkipped,\n\t\tlastActiveStep,\n\t\tlastStep,\n\t\tnextStep,\n\t\tpassedSteps,\n\t\tprevStep,\n\t\tshownSteps,\n\t\tskippedAt,\n\t\tskippedSteps,\n\t\tsteps: [...steps],\n\t};\n}\n\n/**\n * Pure factory for `IWizardTreeState`. Builds stepMap, groups steps by category in declaration order,\n * groups categories by branch (a category may belong to multiple branches), and\n * picks the active branch.\n */\nexport function buildWizardTreeState<Step extends string, Category extends string, Branch extends string = string>(\n\tstate: ReadonlyArray<IWizardStepState<Step, Category, Branch>>,\n\tactiveBranchId?: Branch | null\n): IWizardTreeState<Step, Category, Branch> {\n\tconst stepMap = {} as Record<Step, IWizardStepState<Step, Category, Branch>>;\n\n\tconst categoryOrder: Category[] = [];\n\tconst stepsByCategory = {} as Record<Category, Array<IWizardStepState<Step, Category, Branch>>>;\n\n\tfor (const step of state) {\n\t\tstepMap[step.id] = step;\n\n\t\tif (!stepsByCategory[step.categoryId]) {\n\t\t\tcategoryOrder.push(step.categoryId);\n\t\t\tstepsByCategory[step.categoryId] = [];\n\t\t}\n\n\t\tstepsByCategory[step.categoryId].push(step);\n\t}\n\n\tconst categoryMap = {} as Record<Category, IWizardCategoryState<Step, Category, Branch>>;\n\tconst categoriesByBranch = {} as Record<Branch, Array<IWizardCategoryState<Step, Category, Branch>>>;\n\n\tfor (const [index, categoryId] of categoryOrder.entries()) {\n\t\tconst categoryState = buildWizardCategoryState<Step, Category, Branch>(\n\t\t\tcategoryId,\n\t\t\tindex,\n\t\t\tstepsByCategory[categoryId]\n\t\t);\n\t\tcategoryMap[categoryId] = categoryState;\n\n\t\tfor (const branchId of categoryState.branches) {\n\t\t\t(categoriesByBranch[branchId] ??= []).push(categoryState);\n\t\t}\n\t}\n\n\tconst branchMap = {} as Record<Branch, IWizardBranchState<Step, Category, Branch>>;\n\tconst branches: Array<IWizardBranchState<Step, Category, Branch>> = [];\n\n\tfor (const branchId of Object.keys(categoriesByBranch) as Branch[]) {\n\t\tconst branchState = buildWizardBranchState<Step, Category, Branch>(branchId, categoriesByBranch[branchId]);\n\t\tbranchMap[branchId] = branchState;\n\t\tbranches.push(branchState);\n\t}\n\n\tconst activeBranch = pickActiveBranch(branches, branchMap, activeBranchId);\n\tconst activeCategory = activeBranch.activeCategory;\n\tconst activeSteps = activeCategory.activeSteps;\n\tconst lastActiveStep = last(activeSteps) as IWizardStepState<Step, Category, Branch>;\n\n\treturn {\n\t\tactiveBranch,\n\t\tactiveCategory,\n\t\tactiveSteps,\n\t\tbranches,\n\t\tbranchMap,\n\t\tcategoryMap,\n\t\tid: getStateId(state as Array<IWizardStepState<Step, Category, Branch>>),\n\t\tlastActiveStep,\n\t\tstate: [...state],\n\t\tstepMap,\n\t};\n}\n\nfunction pickActiveBranch<Step extends string, Category extends string, Branch extends string>(\n\tbranches: ReadonlyArray<IWizardBranchState<Step, Category, Branch>>,\n\tbranchMap: Record<Branch, IWizardBranchState<Step, Category, Branch>>,\n\tactiveBranchId?: Branch | null\n): IWizardBranchState<Step, Category, Branch> {\n\tif (branches.length === 1) {\n\t\treturn branches[0]!;\n\t}\n\n\tconst activeBranches = branches.filter(branch => branch.activeCategories.length > 0);\n\n\tif (activeBranches.length === 1) {\n\t\treturn activeBranches[0]!;\n\t}\n\n\tif (activeBranchId && branchMap[activeBranchId]) {\n\t\treturn branchMap[activeBranchId];\n\t}\n\n\treturn activeBranches[0] ?? branches[0]!;\n}\n","import type { IWizardEntityState } from '../../interfaces/wizard-entity-state.interface';\n\n/**\n * Default per-step entity state.\n */\nexport const wizardDefaultState: IWizardEntityState = {\n\tisActive: false,\n\tisCompleted: false,\n\tisShow: true,\n\tisSkipped: false,\n};\n\n/**\n * Default branch id when steps don't declare branches.\n */\nexport const wizardDefaultBranch = 'main';\n","import type { IWizardTreeState } from '../state';\n\n/**\n * Base contract every wizard tree-state rule must implement.\n *\n * Rules run on every freshly built tree before it's published; any rule that\n * fails throws a `WizardError`, aborting the build. This keeps invariants\n * (single active category, no skipped-but-active step, etc.) checked centrally.\n */\nexport abstract class WizardRule {\n\tpublic abstract verify(tree: Readonly<IWizardTreeState<string, string>>): never | void;\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardActiveStepRule extends WizardRule {\n\tpublic override verify({ lastActiveStep }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tif (!lastActiveStep) {\n\t\t\tthrow new WizardError('[WizardActiveStepRule]: There are no available active step in tree state.');\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardPassedPrevCategoriesRule extends WizardRule {\n\tpublic override verify({ activeBranch, activeCategory }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tconst prevCategories = activeBranch.shownCategories.slice(0, activeBranch.activeCategoryIndex);\n\n\t\tconst hasUnpassedPrevCategories = prevCategories.some(prevCategory => !prevCategory.isPassed);\n\n\t\tif (hasUnpassedPrevCategories) {\n\t\t\tconst prevCategoryNames = prevCategories.map(prevCategory => prevCategory.id).join(',');\n\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardPassedPrevCategoriesRule]: Active category \"${activeCategory.id}\" has neither completed nor skipped prev categories. Please, skip or complete categories: \"${prevCategoryNames}\".`\n\t\t\t);\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardPassedPrevStepsRule extends WizardRule {\n\tpublic override verify({ activeCategory }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tconst prevSteps = activeCategory.shownSteps.slice(0, activeCategory.activeStepIndex);\n\t\tconst prevUnpassedSteps = prevSteps.filter(prevStep => !prevStep.isCompleted && !prevStep.isSkipped);\n\n\t\tif (prevUnpassedSteps.length) {\n\t\t\tconst prevStepNames = prevUnpassedSteps.map(prevStep => prevStep.id).join(',');\n\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardPassedPrevStepsRule]: Last active step \"${activeCategory.lastActiveStep.id}\" has not completed steps before. Please, complete or hide steps: \"${prevStepNames}\".`\n\t\t\t);\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardShownActiveCategoryRule extends WizardRule {\n\tpublic override verify({ activeCategory }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tif (!activeCategory.isShow) {\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardShownActiveCategoryRule]: Active category is hidden. Please, show category \"${activeCategory.id}\" to be able to activate it.`\n\t\t\t);\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardError } from '../errors';\nimport { WizardRule } from './wizard-rule';\n\nexport class WizardSingleActiveCategoryRule extends WizardRule {\n\tpublic override verify({ activeBranch }: Readonly<IWizardTreeState<string, string>>): void {\n\t\tif (activeBranch.activeCategories.length > 1) {\n\t\t\tconst activeCategoryNames = activeBranch.activeCategories.map(c => c.id).join(',');\n\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardSingleActiveCategoryRule]: There are 2 active categories at the same time: ${activeCategoryNames}.`\n\t\t\t);\n\t\t}\n\t}\n}\n","import type { WizardRule } from './wizard-rule';\n\nimport { WizardActiveStepRule } from './wizard-active-step.rule';\nimport { WizardPassedPrevCategoriesRule } from './wizard-passed-prev-categories.rule';\nimport { WizardPassedPrevStepsRule } from './wizard-passed-prev-steps.rule';\nimport { WizardShownActiveCategoryRule } from './wizard-shown-active-category.rule';\nimport { WizardSingleActiveCategoryRule } from './wizard-single-active-category.rule';\n\n/**\n * Default rule chain run by `WizardTreeStateBuilder.validate(tree)` on every build.\n */\nexport const wizardRules: WizardRule[] = [\n\tnew WizardActiveStepRule(),\n\tnew WizardSingleActiveCategoryRule(),\n\tnew WizardShownActiveCategoryRule(),\n\tnew WizardPassedPrevStepsRule(),\n\tnew WizardPassedPrevCategoriesRule(),\n];\n","import type { IWizardState } from '../../interfaces/wizard-step-state-data.interface';\nimport type { IWizardBranchState } from './wizard-branch.state';\nimport type { IWizardCategoryState } from './wizard-category.state';\nimport type { IWizardStepState } from './wizard-step.state';\n\n/**\n * Wizard tree state subtype for the initial tree.\n */\nexport type IWizardInitTreeState<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> = IWizardTreeState<Step, Category, Branch>;\n\nexport interface IWizardTreeState<Step extends string, Category extends string, Branch extends string = string> {\n\treadonly activeBranch: IWizardBranchState<Step, Category, Branch>;\n\n\treadonly activeCategory: IWizardCategoryState<Step, Category, Branch>;\n\n\treadonly activeSteps: Array<IWizardStepState<Step, Category, Branch>>;\n\n\treadonly branches: Array<IWizardBranchState<Step, Category, Branch>>;\n\treadonly branchMap: Record<Branch, IWizardBranchState<Step, Category, Branch>>;\n\treadonly categoryMap: Record<Category, IWizardCategoryState<Step, Category, Branch>>;\n\n\treadonly id: string;\n\treadonly lastActiveStep: IWizardStepState<Step, Category, Branch>;\n\treadonly state: IWizardState<Step, Category, Branch>;\n\treadonly stepMap: Record<Step, IWizardStepState<Step, Category, Branch>>;\n}\n\n/**\n * Terminal \"complete\" tree state. See `WizardExitTreeState` for the rationale on\n * keeping this as a class.\n */\nexport class WizardCompleteTreeState<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic readonly state = 'complete' as const;\n\n\tconstructor(public readonly originTree: Readonly<IWizardTreeState<Step, Category, Branch>>) {}\n}\n\n/**\n * Terminal \"exit\" tree state. Carries the originating tree so listeners can read\n * what state the wizard exited from. Kept as a class so the navigation pipeline can\n * branch on it via `instanceof`.\n */\nexport class WizardExitTreeState<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic readonly state = 'exit' as const;\n\n\tconstructor(public readonly originTree: Readonly<IWizardTreeState<Step, Category, Branch>>) {}\n}\n","import type { IWizardTreeState } from './wizard-tree.state';\n\nimport { WizardCompleteTreeState, WizardExitTreeState } from './wizard-tree.state';\n\n/**\n * Project a navigation target back to its underlying tree.\n *\n * The tree is a structural interface, so the terminal types are standalone\n * classes that wrap an `originTree`. This helper returns whichever tree the\n * static helpers should operate on.\n */\nexport const projectToTree = <Step extends string, Category extends string, Branch extends string>(\n\ttarget:\n\t\t| Readonly<IWizardTreeState<Step, Category, Branch>>\n\t\t| WizardCompleteTreeState<Step, Category, Branch>\n\t\t| WizardExitTreeState<Step, Category, Branch>\n): Readonly<IWizardTreeState<Step, Category, Branch>> =>\n\ttarget instanceof WizardExitTreeState || target instanceof WizardCompleteTreeState ? target.originTree : target;\n","import { wizardRules } from '../rules';\nimport { type IWizardStepState, type IWizardTreeState, WizardCompleteTreeState, WizardExitTreeState } from '../state';\nimport { buildWizardTreeState } from './build-tree-state';\nimport { wizardDefaultState } from './wizard-default.const';\n\ntype MutableStepState<Step extends string, Category extends string, Branch extends string> = {\n\t-readonly [K in keyof IWizardStepState<Step, Category, Branch>]: IWizardStepState<Step, Category, Branch>[K];\n};\n\n/**\n * Mutator for wizard tree state. Fluent API: clone an existing tree, mutate\n * flat per-step flags, then call `build()` to produce a fully-derived (and\n * rule-validated) tree.\n */\nexport class WizardTreeStateBuilder<Step extends string, Category extends string, Branch extends string = string> {\n\tprivate readonly branch: Branch;\n\tprivate readonly state: Array<MutableStepState<Step, Category, Branch>>;\n\n\tconstructor(treeState: Readonly<IWizardTreeState<Step, Category, Branch>>, branch?: Branch | null) {\n\t\tthis.state = treeState.state.map(step => ({ ...step }));\n\t\tthis.branch = (branch ?? treeState.activeBranch.id) as Branch;\n\t}\n\n\tpublic static validate<Step extends string, Category extends string, Branch extends string = string>(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\twizardRules.forEach(rule => rule.verify(tree as Readonly<IWizardTreeState<string, string, string>>));\n\t\treturn tree;\n\t}\n\n\t/** Activate completed steps + the next step after the last completed one. */\n\tpublic activateCategory(categoryId: Category): this {\n\t\tconst shown = this.getCategoryStepStates(categoryId).filter(s => s.isShow);\n\n\t\tfor (let i = 0; i < shown.length; i++) {\n\t\t\tconst step = shown[i]!;\n\t\t\tconst prev = shown[i - 1];\n\t\t\tstep.isActive = step.isCompleted || (prev?.isCompleted ?? true);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/** Activate first shown step of a category; deactivate the rest. */\n\tpublic activateFirstStep(categoryId: Category): this {\n\t\tconst shown = this.getCategoryStepStates(categoryId).filter(step => step.isShow);\n\n\t\tif (shown.length === 0) return this;\n\n\t\tshown[0]!.isActive = true;\n\t\tfor (let i = 1; i < shown.length; i++) {\n\t\t\tshown[i]!.isActive = false;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t// ================\n\t// Step actions\n\t// ================\n\tpublic activateStep(step: Step): this {\n\t\tthis.getStepState(step).isActive = true;\n\t\treturn this;\n\t}\n\n\tpublic build(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst tree = buildWizardTreeState<Step, Category, Branch>(this.state, this.branch);\n\t\tWizardTreeStateBuilder.validate(tree);\n\t\treturn Object.freeze(tree);\n\t}\n\n\t/** Build a terminal complete tree (skips rule validation since the tree is sealed). */\n\tpublic buildComplete(): Readonly<WizardCompleteTreeState<Step, Category, Branch>> {\n\t\tconst tree = buildWizardTreeState<Step, Category, Branch>(this.state, this.branch);\n\t\treturn Object.freeze(new WizardCompleteTreeState(tree));\n\t}\n\n\t/** Build a terminal exit tree (skips rule validation since the tree is sealed). */\n\tpublic buildExit(): Readonly<WizardExitTreeState<Step, Category, Branch>> {\n\t\tconst tree = buildWizardTreeState<Step, Category, Branch>(this.state, this.branch);\n\t\treturn Object.freeze(new WizardExitTreeState(tree));\n\t}\n\n\tpublic completeCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isCompleted = true));\n\t\treturn this;\n\t}\n\n\t// ================\n\t// Category actions\n\t// ================\n\n\tpublic completeStep(step: Step): this {\n\t\tthis.getStepState(step).isCompleted = true;\n\t\treturn this;\n\t}\n\n\tpublic deactivateCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isActive = false));\n\t\treturn this;\n\t}\n\n\tpublic deactivateStep(step: Step): this {\n\t\tthis.getStepState(step).isActive = false;\n\t\treturn this;\n\t}\n\n\tpublic getCategoryStepStates(categoryId: Category): Array<MutableStepState<Step, Category, Branch>> {\n\t\treturn this.state.filter(step => step.categoryId === categoryId);\n\t}\n\n\t/** Reset every step in the tree to `wizardDefaultState`. */\n\tpublic getResetTree(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tthis.state.forEach(step => Object.assign(step, wizardDefaultState));\n\t\tconst firstStep = this.state[0];\n\t\tif (firstStep) {\n\t\t\tfirstStep.isActive = true;\n\t\t}\n\t\treturn Object.freeze(buildWizardTreeState<Step, Category, Branch>(this.state, this.branch));\n\t}\n\n\tpublic getStepState(step: Step): MutableStepState<Step, Category, Branch> {\n\t\tconst found = this.state.find(s => s.id === step);\n\t\tif (!found) {\n\t\t\tthrow new Error(`[WizardTreeStateBuilder] Unknown step \"${step}\"`);\n\t\t}\n\t\treturn found;\n\t}\n\n\tpublic hideCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isShow = false));\n\t\treturn this;\n\t}\n\n\tpublic hideStep(step: Step): this {\n\t\tthis.getStepState(step).isShow = false;\n\t\treturn this;\n\t}\n\n\t/** Reset category steps from `from` index onward; deactivate all but first. */\n\tpublic resetCategory(categoryId: Category, from = 0): this {\n\t\tconst slice = this.getCategoryStepStates(categoryId).slice(from);\n\t\tslice.forEach((step, index) => {\n\t\t\tstep.isActive = step.isActive && index === 0;\n\t\t\tstep.isCompleted = false;\n\t\t});\n\t\treturn this;\n\t}\n\n\tpublic showCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isShow = true));\n\t\treturn this;\n\t}\n\n\t// ================\n\t// Build / reset\n\t// ================\n\n\tpublic showStep(step: Step): this {\n\t\tthis.getStepState(step).isShow = true;\n\t\treturn this;\n\t}\n\n\tpublic skipCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isSkipped = true));\n\t\treturn this;\n\t}\n\n\tpublic skipCategoryUncompleted(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId)\n\t\t\t.filter(step => !step.isCompleted)\n\t\t\t.forEach(step => (step.isSkipped = true));\n\t\treturn this;\n\t}\n\n\tpublic uncompleteStep(step: Step): this {\n\t\tthis.getStepState(step).isCompleted = false;\n\t\treturn this;\n\t}\n\n\tpublic unskipCategory(categoryId: Category): this {\n\t\tthis.getCategoryStepStates(categoryId).forEach(step => (step.isSkipped = false));\n\t\treturn this;\n\t}\n}\n","import type { IWizardConfigOptions } from '../interfaces';\nimport type { WizardInitializer } from './initializers';\nimport type { WizardListener } from './listeners';\nimport type {\n\tWizardProgressStrategy,\n\tWizardScrollContainer,\n\tWizardScrollStrategy,\n\tWizardVisibilityStrategy,\n} from './strategies';\nimport type { WizardEngineStrategies } from './wizard-engine';\n\n/**\n * Aggregated provider props — what `<WizardProvider>` (Phase 15) consumes and\n * passes through to `new WizardEngine(...)`. Built up by chaining `with*`\n * helpers via `composeWizardProviders(...)`.\n */\nexport interface IWizardProviderProps<Step extends string, Category extends string, Branch extends string = string> {\n\tconfig: Partial<IWizardConfigOptions<Category>>;\n\tinitializers: Array<WizardInitializer<Step, Category, Branch>>;\n\tlisteners: Array<WizardListener<Step, Category, Branch>>;\n\tscrollContainer?: WizardScrollContainer;\n\tstrategies: WizardEngineStrategies<Step, Category, Branch>;\n}\n\n/**\n * Modifier function — receives the props in flight, mutates them, returns void.\n * Each `with*` helper returns one of these.\n */\nexport type WizardProviderMod<Step extends string, Category extends string, Branch extends string = string> = (\n\tprops: IWizardProviderProps<Step, Category, Branch>\n) => void;\n\nexport function composeWizardProviders<Step extends string, Category extends string, Branch extends string = string>(\n\t...mods: Array<WizardProviderMod<Step, Category, Branch>>\n): IWizardProviderProps<Step, Category, Branch> {\n\tconst props: IWizardProviderProps<Step, Category, Branch> = {\n\t\tconfig: {},\n\t\tinitializers: [],\n\t\tlisteners: [],\n\t\tstrategies: {},\n\t};\n\n\tfor (const mod of mods) {\n\t\tmod(props);\n\t}\n\n\treturn props;\n}\n\nexport const withConfig =\n\t<Step extends string = string, Category extends string = string, Branch extends string = string>(\n\t\toptions: Partial<IWizardConfigOptions<Category>>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.config = { ...props.config, ...options };\n\t};\n\nexport const withInitializer =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tinitializer: WizardInitializer<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.initializers.push(initializer);\n\t};\n\nexport const withListener =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tlistener: WizardListener<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.listeners.push(listener);\n\t};\n\nexport const withScrollStrategy =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tstrategy: WizardScrollStrategy<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.strategies.scroll = strategy;\n\t};\n\n/**\n * Point the wizard's scroll strategy at a specific element instead of the\n * window. Pass a getter when the container lives behind a React ref so the\n * element resolves at scroll time, after commit.\n */\nexport const withScrollContainer =\n\t<Step extends string = string, Category extends string = string, Branch extends string = string>(\n\t\tcontainer: WizardScrollContainer\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.scrollContainer = container;\n\t};\n\nexport const withProgressStrategy =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tstrategy: WizardProgressStrategy<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.strategies.progress = strategy;\n\t};\n\nexport const withVisibilityStrategy =\n\t<Step extends string, Category extends string, Branch extends string = string>(\n\t\tstrategy: WizardVisibilityStrategy<Step, Category, Branch>\n\t): WizardProviderMod<Step, Category, Branch> =>\n\tprops => {\n\t\tprops.strategies.visibility = strategy;\n\t};\n","import type { WizardNavigation } from '../navigation';\n\nimport { WizardEventType } from '../../enums/wizard-event-type.enum';\n\n/**\n * General parent event for all wizard events.\n */\nexport abstract class WizardEvent<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic abstract readonly type: WizardEventType;\n\n\t/** @param navigation - Specific navigation data associated with event */\n\tconstructor(public readonly navigation?: WizardNavigation<Step, Category, Branch>) {}\n}\n\nexport class WizardCompleteEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.Complete = WizardEventType.Complete;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\n/**\n * Exit can be triggered in 2 ways:\n * - as a part of navigation (with navigation data)\n * - before wizard init, where no state exists yet\n */\nexport class WizardExitEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.Exit = WizardEventType.Exit;\n}\n\nexport class WizardNavigationCancelledEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationCancelled = WizardEventType.NavigationCancelled;\n\n\tconstructor(\n\t\tpublic override readonly navigation: WizardNavigation<Step, Category, Branch>,\n\t\tpublic readonly reason: 'new_navigation' | 'resolver'\n\t) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardNavigationEndEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationEnd = WizardEventType.NavigationEnd;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardNavigationErrorEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationError = WizardEventType.NavigationError;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardNavigationIgnoredEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationIgnored = WizardEventType.NavigationIgnored;\n\n\tconstructor(\n\t\tpublic override readonly navigation: WizardNavigation<Step, Category, Branch>,\n\t\tpublic readonly reason: 'same_navigation'\n\t) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardNavigationStartEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.NavigationStart = WizardEventType.NavigationStart;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardResolveEndEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.ResolveEnd = WizardEventType.ResolveEnd;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardResolveStartEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.ResolveStart = WizardEventType.ResolveStart;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardScrollEndEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.ScrollEnd = WizardEventType.ScrollEnd;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardScrollStartEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.ScrollStart = WizardEventType.ScrollStart;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardStepHideEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.StepHide = WizardEventType.StepHide;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n\nexport class WizardStepShowEvent<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardEvent<Step, Category, Branch> {\n\tpublic readonly type: WizardEventType.StepShow = WizardEventType.StepShow;\n\n\tconstructor(public override readonly navigation: WizardNavigation<Step, Category, Branch>) {\n\t\tsuper(navigation);\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\n/**\n * Base contract for wizard tree-state initializers. Each initializer in a chain\n * receives the result of the previous one (and the original HTML tree) and may\n * mutate the active step / category / completion based on persisted state, URL\n * params, server data, etc.\n */\nexport abstract class WizardInitializer<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic abstract getState(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>,\n\t\thtmlTree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Promise<Readonly<IWizardTreeState<Step, Category, Branch>>> | Readonly<IWizardTreeState<Step, Category, Branch>>;\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { WizardTreeStateBuilder } from '../builders';\nimport { WizardInitializer } from './wizard-initializer';\n\n/**\n * Default initializer: if the tree already has an active step, return it as-is.\n * Otherwise activate the first non-passed category (or the active category as\n * a fallback) so the wizard always boots with a valid active step.\n */\nexport class WizardDefaultInitializer<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardInitializer<Step, Category, Branch> {\n\tpublic override getState(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tif (tree.activeSteps.length > 0) {\n\t\t\treturn builder.build();\n\t\t}\n\n\t\tconst firstUnpassed =\n\t\t\ttree.activeBranch.shownCategories.find(category => !category.isPassed) ?? tree.activeCategory;\n\n\t\treturn builder.activateCategory(firstUnpassed.id).build();\n\t}\n}\n","import type { WizardEvent } from '../events/wizard-events';\nimport type { IWizardTreeState } from '../state';\n\n/**\n * Base contract for wizard lifecycle listeners.\n */\nexport abstract class WizardListener<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic onDestroy(_tree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\treturn;\n\t}\n\n\tpublic onEvent(_event: WizardEvent<Step, Category, Branch>): void {\n\t\treturn;\n\t}\n\n\tpublic onInit(_tree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\treturn;\n\t}\n\n\tpublic onTreeChange(_tree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\treturn;\n\t}\n}\n","import type { WizardInitializer } from '../initializers';\nimport type { IWizardStepState, IWizardTreeState } from '../state';\nimport type { WizardLog } from '../wizard-log';\n\nimport { buildWizardTreeState } from '../builders';\nimport { WizardError, WizardInitializationError } from '../errors';\n\n/**\n * Runs the registered initializer chain on top of the HTML-derived tree to\n * produce the boot state. Validates step uniqueness and active-branch presence\n * before delegating to the chain.\n */\nexport class WizardInitializerService<Step extends string, Category extends string, Branch extends string = string> {\n\tconstructor(\n\t\tprivate readonly wizardLog: WizardLog,\n\t\tprivate readonly wizardInitializers: ReadonlyArray<WizardInitializer<Step, Category, Branch>>\n\t) {}\n\n\tpublic async getInitialState(\n\t\tstate: ReadonlyArray<IWizardStepState<Step, Category, Branch>>,\n\t\tactiveBranch?: Branch\n\t): Promise<Readonly<IWizardTreeState<Step, Category, Branch>>> {\n\t\tconst htmlTree = buildWizardTreeState<Step, Category, Branch>(state, activeBranch);\n\n\t\tthis.wizardLog.trace('HTML tree', htmlTree);\n\n\t\ttry {\n\t\t\tthis.validateHtmlTree(htmlTree);\n\t\t\tthis.validateActiveBranch(htmlTree, activeBranch);\n\n\t\t\tlet tree: Readonly<IWizardTreeState<Step, Category, Branch>> = htmlTree;\n\n\t\t\tfor (const initializer of this.wizardInitializers) {\n\t\t\t\ttree = await initializer.getState(tree, htmlTree);\n\t\t\t\tthis.wizardLog.trace('Initializer', initializer, tree);\n\t\t\t}\n\n\t\t\treturn tree;\n\t\t} catch (e) {\n\t\t\tthis.wizardLog.error(e);\n\t\t\t// Fall back to the HTML-derived tree if any initializer rejects.\n\t\t\treturn htmlTree;\n\t\t}\n\t}\n\n\tprivate validateActiveBranch(\n\t\thtmlTree: Readonly<IWizardTreeState<Step, Category, Branch>>,\n\t\tactiveBranch?: Branch\n\t): void {\n\t\tif (!activeBranch) return;\n\n\t\tif (!htmlTree.branchMap[activeBranch]) {\n\t\t\tconst branchIds = htmlTree.branches.map(branch => branch.id).join(',');\n\t\t\tthrow new WizardError(\n\t\t\t\t`[WizardInitializerService02]: There is no branch with id \"${activeBranch}\". List of available branches: ${branchIds}.`\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate validateHtmlTree(htmlTree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\tconst seen = new Set<Step>();\n\t\tconst duplicates: Step[] = [];\n\t\tfor (const s of htmlTree.state) {\n\t\t\tif (seen.has(s.id)) duplicates.push(s.id);\n\t\t\telse seen.add(s.id);\n\t\t}\n\n\t\tif (duplicates.length > 0) {\n\t\t\tthrow new WizardInitializationError(\n\t\t\t\t`[WizardInitializerService01]: There are steps with the same ID: ${duplicates.join(',')}.`\n\t\t\t);\n\t\t}\n\t}\n}\n","type Listener<E> = (event: E) => void;\n\n/**\n * Tiny typed event emitter. Subscribers can listen to a specific event type\n * (matched on `event.type`) or via the `'*'` wildcard. Returns an unsubscribe\n * handle from `on()`.\n */\nexport class TypedEmitter<E extends { type: string }> {\n\tprivate readonly map = new Map<'*' | string, Set<Listener<E>>>();\n\n\tpublic dispose(): void {\n\t\tthis.map.clear();\n\t}\n\n\tpublic emit(event: E): void {\n\t\tconst specific = this.map.get(event.type);\n\t\tif (specific) {\n\t\t\tfor (const handler of [...specific]) handler(event);\n\t\t}\n\t\tconst wildcard = this.map.get('*');\n\t\tif (wildcard) {\n\t\t\tfor (const handler of [...wildcard]) handler(event);\n\t\t}\n\t}\n\n\tpublic on(type: '*' | E['type'], handler: Listener<E>): () => void {\n\t\tlet set = this.map.get(type);\n\t\tif (!set) {\n\t\t\tset = new Set();\n\t\t\tthis.map.set(type, set);\n\t\t}\n\t\tset.add(handler);\n\t\treturn () => {\n\t\t\tset!.delete(handler);\n\t\t};\n\t}\n}\n","import type { IWizardTreeState } from '../state';\n\nimport { projectToTree, WizardCompleteTreeState, WizardExitTreeState } from '../state';\n\nexport class WizardNavigation<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic readonly direction: 'back' | 'next';\n\tpublic readonly id: string;\n\tpublic readonly isCategoryChanging: boolean;\n\tpublic readonly isComplete: boolean;\n\tpublic readonly isExit: boolean;\n\tpublic readonly isScrollChanging: boolean;\n\tpublic readonly isSkipping: boolean;\n\n\tconstructor(\n\t\tpublic readonly from: Readonly<IWizardTreeState<Step, Category, Branch>>,\n\t\tpublic readonly to:\n\t\t\t| Readonly<IWizardTreeState<Step, Category, Branch>>\n\t\t\t| WizardCompleteTreeState<Step, Category, Branch>\n\t\t\t| WizardExitTreeState<Step, Category, Branch>\n\t) {\n\t\tconst toTree = projectToTree(to);\n\n\t\tthis.id = `${from.id}=>${toTree.id}`;\n\t\tthis.direction = WizardNavigation.getDirection(from, toTree);\n\t\tthis.isSkipping = WizardNavigation.isSkipping(from, toTree, this.direction);\n\t\tthis.isCategoryChanging = WizardNavigation.isCategoryChanging(from, toTree);\n\t\tthis.isScrollChanging = WizardNavigation.isScrollChanging(from, toTree);\n\n\t\tthis.isExit = to instanceof WizardExitTreeState;\n\t\tthis.isComplete = to instanceof WizardCompleteTreeState;\n\t}\n\n\tpublic static getDirection(\n\t\tfrom: Readonly<IWizardTreeState<string, string>>,\n\t\tto: Readonly<IWizardTreeState<string, string>>\n\t): 'back' | 'next' {\n\t\t// back/next between categories in branch\n\t\tif (WizardNavigation.isCategoryChanging(from, to)) {\n\t\t\treturn from.activeCategory.htmlIndex > to.activeCategory.htmlIndex ? 'back' : 'next';\n\t\t}\n\n\t\t// back/next on first/last step\n\t\tif (from.activeCategory.activeStepIndex === to.activeCategory.activeStepIndex) {\n\t\t\treturn to.activeCategory.id === to.activeBranch.firstCategory.id ? 'back' : 'next';\n\t\t}\n\n\t\t// back/next between steps in category\n\t\treturn from.activeCategory.activeStepIndex > to.activeCategory.activeStepIndex ? 'back' : 'next';\n\t}\n\n\tpublic static isCategoryChanging(\n\t\tfrom: Readonly<IWizardTreeState<string, string>>,\n\t\tto: Readonly<IWizardTreeState<string, string>>\n\t): boolean {\n\t\treturn from.activeCategory.id !== to.activeCategory.id;\n\t}\n\n\tpublic static isScrollChanging(\n\t\tfrom: Readonly<IWizardTreeState<string, string>>,\n\t\tto: Readonly<IWizardTreeState<string, string>>\n\t): boolean {\n\t\tconst isSamePosition = from.activeCategory.activeStepIndex === to.activeCategory.activeStepIndex;\n\t\tconst isSameStep = from.activeCategory.lastActiveStep.id === to.activeCategory.lastActiveStep.id;\n\n\t\treturn !isSameStep || !isSamePosition;\n\t}\n\n\t/**\n\t * Navigation counted as skipped when Category \"A\" was \"active\" and not \"skipped\" before transition\n\t * and became \"inactive\" and \"skipped\" after transition.\n\t */\n\tpublic static isSkipping(\n\t\tfrom: Readonly<IWizardTreeState<string, string>>,\n\t\tto: Readonly<IWizardTreeState<string, string>>,\n\t\tdirection: 'back' | 'next' = WizardNavigation.getDirection(from, to)\n\t): boolean {\n\t\tif (direction === 'back') {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst isPrevCategoryAlreadySkipped = from.activeCategory.isSkipped;\n\t\tconst isPrevCategorySkipped = to.categoryMap[from.activeCategory.id].isSkipped;\n\n\t\treturn !isPrevCategoryAlreadySkipped && isPrevCategorySkipped;\n\t}\n}\n","import type { IWizardResolverHook } from '../../interfaces';\nimport type { WizardScrollStrategy } from '../strategies';\nimport type { WizardConfig } from '../wizard-config';\nimport type { WizardStore } from '../wizard-store';\n\nimport { WizardEventType } from '../../enums/wizard-event-type.enum';\nimport { WizardResolverError } from '../errors';\nimport {\n\tWizardCompleteEvent,\n\ttype WizardEvent,\n\tWizardExitEvent,\n\tWizardNavigationCancelledEvent,\n\tWizardNavigationEndEvent,\n\tWizardNavigationErrorEvent,\n\tWizardNavigationIgnoredEvent,\n\tWizardNavigationStartEvent,\n\tWizardResolveEndEvent,\n\tWizardResolveStartEvent,\n\tWizardScrollEndEvent,\n\tWizardScrollStartEvent,\n\tWizardStepHideEvent,\n\tWizardStepShowEvent,\n} from '../events/wizard-events';\nimport { type IWizardTreeState, WizardCompleteTreeState, WizardExitTreeState } from '../state';\nimport { toArray } from '../utils';\nimport { type WizardStateResult, WizardStateService } from './state-service';\nimport { TypedEmitter } from './typed-emitter';\nimport { WizardNavigation } from './wizard-navigation';\n\ninterface InFlight<Step extends string, Category extends string, Branch extends string> {\n\tabort: AbortController;\n\tnavigation: WizardNavigation<Step, Category, Branch>;\n}\n\n/**\n * Async navigation pipeline. Each `navigate()` (or `showStep` / `hideStep` /\n * `exitWizard` / `completeWizard`) emits a strict ordering of events:\n *\n * NavigationStart → ResolveStart → resolver chain → ResolveEnd → setState →\n * StepShow/StepHide (visibility flips) → ScrollStart → scroll strategy →\n * ScrollEnd → NavigationEnd (or Exit/Complete for terminals)\n *\n * Race semantics: a new navigate() while another is in flight aborts the prior\n * one (emits `NavigationCancelled('new_navigation')` and resolves the prior\n * Promise to `false`). Resolver returning `false` or rejecting emits\n * `NavigationCancelled('resolver')`. Resolver throwing emits `NavigationError`.\n */\nexport class WizardNavigationService<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic get isNavigating(): boolean {\n\t\treturn !!this.inFlight;\n\t}\n\tprivate disposed = false;\n\tprivate readonly emitter = new TypedEmitter<WizardEvent<Step, Category, Branch>>();\n\tprivate inFlight: InFlight<Step, Category, Branch> | null = null;\n\n\tprivate prevSuccessId: null | string = null;\n\n\tconstructor(\n\t\tprivate readonly wizardStore: WizardStore<Step, Category, Branch>,\n\t\tprivate readonly wizardConfig: WizardConfig<Category>,\n\t\tprivate readonly wizardStateService: WizardStateService<Step, Category, Branch>,\n\t\tprivate readonly wizardScrollStrategy: WizardScrollStrategy<Step, Category, Branch>\n\t) {}\n\n\tpublic async completeWizard(): Promise<boolean> {\n\t\tconst tree = this.wizardStore.getTreeSnapshot();\n\t\tconst to = new WizardCompleteTreeState<Step, Category, Branch>(tree);\n\t\treturn this.navigate(to);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tif (this.inFlight) {\n\t\t\tthis.inFlight.abort.abort();\n\t\t\tthis.inFlight = null;\n\t\t}\n\t\tthis.emitter.dispose();\n\t}\n\n\tpublic async exitWizard(): Promise<boolean> {\n\t\ttry {\n\t\t\tconst tree = this.wizardStore.getTreeSnapshot();\n\t\t\tconst to = new WizardExitTreeState<Step, Category, Branch>(tree);\n\t\t\treturn this.navigate(to);\n\t\t} catch {\n\t\t\t// Wizard not initialized — fire a bare Exit event with no navigation\n\t\t\tthis.emitter.emit(new WizardExitEvent<Step, Category, Branch>());\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic async hideCategory(categoryId: Category): Promise<boolean> {\n\t\tconst to = this.wizardStateService.hideCategory(categoryId);\n\t\treturn this.hide(this.projectTree(to));\n\t}\n\n\tpublic async hideStep(step: Step | Step[]): Promise<boolean> {\n\t\tconst tree = this.wizardStore.getTreeSnapshot();\n\t\tconst to = toArray(step).reduce<WizardStateResult<Step, Category, Branch>>((acc, id) => {\n\t\t\tconst accTree = this.projectTree(acc);\n\t\t\treturn this.wizardStateService.hideStep(id, accTree);\n\t\t}, tree);\n\t\treturn this.hide(this.projectTree(to));\n\t}\n\n\tpublic async navigate(to: WizardStateResult<Step, Category, Branch>): Promise<boolean> {\n\t\tif (this.disposed) return false;\n\n\t\tconst fromTree = this.wizardStore.getTreeSnapshot();\n\t\tconst navigation = new WizardNavigation<Step, Category, Branch>(fromTree, to);\n\n\t\t// Same-navigation guard\n\t\tif (navigation.id === this.prevSuccessId && !navigation.isExit && !navigation.isComplete) {\n\t\t\tthis.emitter.emit(new WizardNavigationIgnoredEvent(navigation, 'same_navigation'));\n\t\t\treturn false;\n\t\t}\n\n\t\t// Cancel any in-flight navigation\n\t\tif (this.inFlight) {\n\t\t\tconst prior = this.inFlight;\n\t\t\tprior.abort.abort();\n\t\t\tthis.inFlight = null;\n\t\t\tthis.emitter.emit(new WizardNavigationCancelledEvent(prior.navigation, 'new_navigation'));\n\t\t}\n\n\t\tconst abort = new AbortController();\n\t\tthis.inFlight = { abort, navigation };\n\n\t\ttry {\n\t\t\tthis.emitter.emit(new WizardNavigationStartEvent(navigation));\n\t\t\tthis.emitter.emit(new WizardResolveStartEvent(navigation));\n\n\t\t\ttry {\n\t\t\t\tawait this.runResolverChain(navigation, abort.signal);\n\t\t\t} catch (e) {\n\t\t\t\tif (this.isAbortReason(e, abort.signal)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (e instanceof WizardResolverError) {\n\t\t\t\t\tthis.emitter.emit(new WizardNavigationCancelledEvent(navigation, 'resolver'));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tthis.emitter.emit(new WizardNavigationErrorEvent(navigation));\n\n\t\t\t\tconsole.error(e);\n\t\t\t\tthrow e;\n\t\t\t}\n\n\t\t\tif (abort.signal.aborted) return false;\n\n\t\t\tthis.emitter.emit(new WizardResolveEndEvent(navigation));\n\n\t\t\t// Commit state\n\t\t\tthis.commitTree(navigation, to);\n\n\t\t\t// Visibility flips\n\t\t\tthis.emitVisibilityFlips(navigation, fromTree, to);\n\n\t\t\t// NavigationEnd / Exit / Complete\n\t\t\tthis.emitter.emit(new WizardNavigationEndEvent(navigation));\n\t\t\tif (navigation.isExit) this.emitter.emit(new WizardExitEvent(navigation));\n\t\t\tif (navigation.isComplete) this.emitter.emit(new WizardCompleteEvent(navigation));\n\n\t\t\t// Scroll (skip on terminals + when no scroll change)\n\t\t\tif (!navigation.isExit && !navigation.isComplete && navigation.isScrollChanging) {\n\t\t\t\tthis.emitter.emit(new WizardScrollStartEvent(navigation));\n\t\t\t\tawait this.wizardScrollStrategy.onNavigate(navigation);\n\t\t\t\tthis.emitter.emit(new WizardScrollEndEvent(navigation));\n\t\t\t}\n\n\t\t\tthis.prevSuccessId = navigation.id;\n\t\t\treturn true;\n\t\t} finally {\n\t\t\tif (this.inFlight && this.inFlight.navigation === navigation) {\n\t\t\t\tthis.inFlight = null;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic on(\n\t\ttype: '*' | WizardEvent<Step, Category, Branch>['type'],\n\t\thandler: (event: WizardEvent<Step, Category, Branch>) => void\n\t): () => void {\n\t\treturn this.emitter.on(type, handler);\n\t}\n\n\tpublic async showCategory(categoryId: Category): Promise<boolean> {\n\t\tconst to = this.wizardStateService.showCategory(categoryId);\n\t\treturn this.show(to);\n\t}\n\n\tpublic async showStep(step: Step | Step[]): Promise<boolean> {\n\t\tconst tree = this.wizardStore.getTreeSnapshot();\n\t\tconst to = toArray(step).reduce<Readonly<IWizardTreeState<Step, Category, Branch>>>(\n\t\t\t(acc, id) => this.wizardStateService.showStep(id, acc),\n\t\t\ttree\n\t\t);\n\t\treturn this.show(to);\n\t}\n\n\t// --- internals ---\n\n\tprivate commitTree(\n\t\tnavigation: WizardNavigation<Step, Category, Branch>,\n\t\tto: WizardStateResult<Step, Category, Branch>\n\t): void {\n\t\tif (navigation.isExit || navigation.isComplete) {\n\t\t\t// Terminal: don't push the terminal state through; keep the originating tree\n\t\t\t// so consumers can still read it. The exit/complete events convey the terminal.\n\t\t\tconst tree = this.projectTree(to);\n\t\t\tthis.wizardStore.setState(tree);\n\t\t\treturn;\n\t\t}\n\t\tthis.wizardStore.setState(to as Readonly<IWizardTreeState<Step, Category, Branch>>);\n\t}\n\n\tprivate emitVisibilityFlips(\n\t\tnavigation: WizardNavigation<Step, Category, Branch>,\n\t\tfrom: Readonly<IWizardTreeState<Step, Category, Branch>>,\n\t\tto: WizardStateResult<Step, Category, Branch>\n\t): void {\n\t\tconst toTree = this.projectTree(to);\n\t\tfor (const stepId of Object.keys(from.stepMap) as Step[]) {\n\t\t\tconst before = from.stepMap[stepId];\n\t\t\tconst after = toTree.stepMap[stepId];\n\t\t\tif (!before || !after) continue;\n\t\t\tif (before.isShow === after.isShow) continue;\n\t\t\tif (after.isShow) {\n\t\t\t\tthis.emitter.emit(new WizardStepShowEvent(navigation));\n\t\t\t} else {\n\t\t\t\tthis.emitter.emit(new WizardStepHideEvent(navigation));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async hide(to: Readonly<IWizardTreeState<Step, Category, Branch>>): Promise<boolean> {\n\t\tconst fromTree = this.wizardStore.getTreeSnapshot();\n\t\tconst navigation = new WizardNavigation<Step, Category, Branch>(fromTree, to);\n\n\t\tthis.wizardStore.setState(to);\n\t\tthis.emitter.emit(new WizardStepHideEvent(navigation));\n\n\t\tif (navigation.isScrollChanging) {\n\t\t\tawait this.wizardScrollStrategy.onToggle(navigation);\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate async invokeResolver(\n\t\tresolver: IWizardResolverHook<Step, Category, Branch> | null | undefined,\n\t\tnavigation: WizardNavigation<Step, Category, Branch>,\n\t\tsignal: AbortSignal\n\t): Promise<void> {\n\t\tif (!resolver) return;\n\t\tif (signal.aborted) throw new DOMException('aborted', 'AbortError');\n\n\t\t// Race the resolver against the abort signal so a cancel-on-new-nav\n\t\t// doesn't have to wait for a long-running resolver to finish.\n\t\tconst abortPromise = new Promise<never>((_, reject) => {\n\t\t\tconst onAbort = () => reject(new DOMException('aborted', 'AbortError'));\n\t\t\tif (signal.aborted) {\n\t\t\t\tonAbort();\n\t\t\t} else {\n\t\t\t\tsignal.addEventListener('abort', onAbort, { once: true });\n\t\t\t}\n\t\t});\n\n\t\tconst result = await Promise.race([Promise.resolve(resolver(navigation as never)), abortPromise]);\n\n\t\tif (signal.aborted) throw new DOMException('aborted', 'AbortError');\n\n\t\tif (!result) {\n\t\t\tthrow new WizardResolverError(`Resolver rejected navigation ${navigation.id}`);\n\t\t}\n\t}\n\n\tprivate isAbortReason(error: unknown, signal: AbortSignal): boolean {\n\t\tif (!signal.aborted) return false;\n\t\tif (error instanceof DOMException && error.name === 'AbortError') return true;\n\t\treturn false;\n\t}\n\n\tprivate projectTree(\n\t\tto: WizardStateResult<Step, Category, Branch>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tif (to instanceof WizardExitTreeState || to instanceof WizardCompleteTreeState) {\n\t\t\treturn to.originTree;\n\t\t}\n\t\treturn to;\n\t}\n\n\tprivate async runResolverChain(\n\t\tnavigation: WizardNavigation<Step, Category, Branch>,\n\t\tsignal: AbortSignal\n\t): Promise<void> {\n\t\tconst config = this.wizardConfig.getOptions();\n\n\t\tif (navigation.direction === 'next' && navigation.isCategoryChanging && !navigation.isSkipping) {\n\t\t\tawait this.invokeResolver(config.resolveCategoryComplete, navigation, signal);\n\t\t}\n\n\t\tif (navigation.isCategoryChanging) {\n\t\t\tawait this.invokeResolver(config.resolveCategoryChange, navigation, signal);\n\t\t}\n\n\t\tif (navigation.isCategoryChanging) {\n\t\t\tawait this.invokeResolver(config.resolveCategoryEnter, navigation, signal);\n\t\t}\n\n\t\tawait this.invokeResolver(config.resolveStepChange, navigation, signal);\n\t}\n\n\tprivate async show(to: WizardStateResult<Step, Category, Branch>): Promise<boolean> {\n\t\tconst fromTree = this.wizardStore.getTreeSnapshot();\n\t\tconst toTree = this.projectTree(to);\n\t\tconst navigation = new WizardNavigation<Step, Category, Branch>(fromTree, toTree);\n\n\t\tthis.wizardStore.setState(toTree);\n\t\tthis.emitter.emit(new WizardStepShowEvent(navigation));\n\n\t\tif (navigation.isScrollChanging) {\n\t\t\tawait this.wizardScrollStrategy.onToggle(navigation);\n\t\t}\n\t\treturn true;\n\t}\n}\n\nexport type { WizardEventType }; // re-export for convenience\n","import type { WizardConfig } from '../wizard-config';\nimport type { WizardStore } from '../wizard-store';\n\nimport { WizardTreeStateBuilder } from '../builders';\nimport { WizardError } from '../errors';\nimport { type IWizardTreeState, WizardCompleteTreeState, WizardExitTreeState } from '../state';\n\n/**\n * Pure-ish next-tree computations. Each method returns a target tree (or a\n * terminal exit/complete subtype) without mutating the store. Methods accept an\n * optional `tree` argument; when omitted they read from the store's current\n * snapshot.\n */\nexport type WizardStateResult<Step extends string, Category extends string, Branch extends string> =\n\t| Readonly<IWizardTreeState<Step, Category, Branch>>\n\t| WizardCompleteTreeState<Step, Category, Branch>\n\t| WizardExitTreeState<Step, Category, Branch>;\n\nexport class WizardStateService<Step extends string, Category extends string, Branch extends string = string> {\n\tconstructor(\n\t\tprivate readonly wizardStore: WizardStore<Step, Category, Branch>,\n\t\tprivate readonly wizardConfig: WizardConfig<Category>\n\t) {}\n\n\tpublic completeCategory(\n\t\tcategory: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch } = tree;\n\t\tconst { activeCategory, nextCategory } = activeBranch;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tbuilder.completeCategory(category);\n\n\t\tif (activeCategory.id === category && nextCategory) {\n\t\t\treturn builder.deactivateCategory(category).activateCategory(nextCategory.id).build();\n\t\t}\n\t\tif (activeCategory.id === category && !nextCategory) {\n\t\t\treturn builder.buildComplete();\n\t\t}\n\t\treturn builder.build();\n\t}\n\n\tpublic goToCategory(\n\t\tcategoryId: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeBranch, activeCategory, branchMap, categoryMap } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst toCategory = categoryMap[categoryId];\n\t\tconst toCategoryFirstBranch = branchMap[toCategory.branches[0]!];\n\t\tconst toCategoryBranch = toCategory.branches.includes(activeBranch.id) ? activeBranch : toCategoryFirstBranch;\n\t\tconst toCategoryIndex = toCategoryBranch.getShownCategoryIndex(toCategory);\n\t\tconst activeCategoryIndex = toCategoryBranch.getShownCategoryIndex(activeCategory);\n\n\t\tif (activeBranch !== toCategoryBranch && toCategoryIndex > activeCategoryIndex) {\n\t\t\tthrow new WizardError(\n\t\t\t\t`[State02]: Trying to switch to category \"${categoryId}\" in different branch \"${toCategoryBranch.id}\" from current active branch \"${activeBranch.id}\", but new category has uncompleted prev category in new branch.`\n\t\t\t);\n\t\t}\n\n\t\tif (toCategoryIndex > activeCategoryIndex) {\n\t\t\tactiveBranch\n\t\t\t\t.getShownCategories(activeCategoryIndex, toCategoryIndex - 1)\n\t\t\t\t.forEach(mid => builder.skipCategoryUncompleted(mid.id));\n\t\t}\n\n\t\tif (this.wizardConfig.getOptions().isBackResetCompleted && toCategoryIndex < activeCategoryIndex) {\n\t\t\tactiveBranch\n\t\t\t\t.getShownCategories(toCategoryIndex + 1, activeCategoryIndex)\n\t\t\t\t.forEach(mid => builder.resetCategory(mid.id));\n\t\t}\n\n\t\tbuilder.deactivateCategory(activeCategory.id);\n\n\t\tif (this.wizardConfig.getOptions().isShowFirstStepOnCategoryChange) {\n\t\t\treturn builder.activateFirstStep(categoryId).build();\n\t\t}\n\n\t\treturn builder.activateCategory(categoryId).build();\n\t}\n\n\tpublic hideCategory(\n\t\tcategoryId: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch, activeCategory } = tree;\n\n\t\tconst projected: Readonly<IWizardTreeState<Step, Category, Branch>> =\n\t\t\tactiveCategory.id === categoryId ? this.projectShownCategory(categoryId, tree) : tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(projected, activeBranch.id);\n\n\t\treturn builder.hideCategory(categoryId).build();\n\t}\n\n\tpublic hideStep(\n\t\tstep: Step,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch, lastActiveStep } = tree;\n\n\t\tconst projected: Readonly<IWizardTreeState<Step, Category, Branch>> =\n\t\t\tlastActiveStep.id === step ? this.projectShownStep(step, tree) : tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(projected, activeBranch.id);\n\n\t\treturn builder.hideStep(step).deactivateStep(step).build();\n\t}\n\n\tpublic next(\n\t\tbranch?: Branch | null,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch, branchMap } = tree;\n\t\tconst nextBranch = branch ? branchMap[branch] : activeBranch;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree, branch ?? activeBranch.id);\n\n\t\tconst activeCategory = nextBranch.activeCategory;\n\t\tconst activeStep = activeCategory.lastActiveStep;\n\n\t\tconst nextCategory = nextBranch.nextCategory;\n\t\tconst nextStep = activeCategory.nextStep;\n\n\t\tif (activeBranch.activeCategory !== nextBranch.activeCategory) {\n\t\t\tthrow new WizardError(\n\t\t\t\t`[State01]: In order to move to the \"${branch}\" branch, you need to have common category between 2 branches`\n\t\t\t);\n\t\t}\n\n\t\tbuilder.unskipCategory(activeCategory.id).completeStep(activeStep.id);\n\n\t\tif (nextStep) {\n\t\t\treturn builder.activateStep(nextStep.id).build();\n\t\t}\n\n\t\tif (nextCategory) {\n\t\t\tbuilder.deactivateCategory(activeCategory.id);\n\n\t\t\tif (this.wizardConfig.getOptions().isShowFirstStepOnCategoryChange) {\n\t\t\t\treturn builder.activateFirstStep(nextCategory.id).build();\n\t\t\t}\n\n\t\t\treturn builder.activateCategory(nextCategory.id).build();\n\t\t}\n\n\t\treturn builder.buildComplete();\n\t}\n\n\tpublic nextCategory(\n\t\tbranch?: Branch | null,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch, branchMap } = tree;\n\t\tconst nextBranch = branch ? branchMap[branch] : activeBranch;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree, branch ?? activeBranch.id);\n\n\t\tconst activeCategory = nextBranch.activeCategory;\n\t\tconst activeStep = activeCategory.lastActiveStep;\n\t\tconst nextCategory = nextBranch.nextCategory;\n\n\t\tif (activeBranch.activeCategory !== nextBranch.activeCategory) {\n\t\t\tthrow new WizardError(\n\t\t\t\t`[State01]: In order to move to the \"${branch}\" branch, you need to have common category between 2 branches`\n\t\t\t);\n\t\t}\n\n\t\tbuilder.deactivateCategory(activeCategory.id).completeStep(activeStep.id);\n\n\t\tif (nextCategory) {\n\t\t\tbuilder.skipCategoryUncompleted(activeCategory.id);\n\n\t\t\tif (this.wizardConfig.getOptions().isShowFirstStepOnCategoryChange) {\n\t\t\t\treturn builder.activateFirstStep(nextCategory.id).build();\n\t\t\t}\n\n\t\t\treturn builder.activateCategory(nextCategory.id).build();\n\t\t}\n\n\t\treturn builder.buildComplete();\n\t}\n\n\tpublic prev(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst activeCategory = activeBranch.activeCategory;\n\t\tconst activeStep = activeCategory.lastActiveStep;\n\n\t\tconst prevCategory = activeBranch.prevCategory;\n\t\tconst prevStep = activeCategory.prevStep;\n\n\t\tif (this.wizardConfig.getOptions().isBackResetCompleted) {\n\t\t\tbuilder.uncompleteStep(activeStep.id);\n\t\t}\n\n\t\tif (prevStep) {\n\t\t\treturn builder.deactivateStep(activeStep.id).build();\n\t\t}\n\n\t\tif (prevCategory) {\n\t\t\treturn builder.deactivateCategory(activeCategory.id).activateCategory(prevCategory.id).build();\n\t\t}\n\n\t\treturn builder.buildExit();\n\t}\n\n\tpublic prevCategory(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst activeCategory = activeBranch.activeCategory;\n\t\tconst prevCategory = activeBranch.prevCategory;\n\n\t\tif (prevCategory && this.wizardConfig.getOptions().isBackResetCompleted) {\n\t\t\tbuilder.resetCategory(activeCategory.id);\n\t\t}\n\n\t\tif (prevCategory) {\n\t\t\treturn builder.deactivateCategory(activeCategory.id).activateCategory(prevCategory.id).build();\n\t\t}\n\n\t\treturn builder.buildExit();\n\t}\n\n\tpublic resetCategory(\n\t\tcategory: Category,\n\t\tfrom = 0,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeCategory } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tbuilder.resetCategory(category, from);\n\n\t\tif (activeCategory.id === category) {\n\t\t\treturn builder.activateStep(activeCategory.firstStep.id).build();\n\t\t}\n\t\treturn builder.build();\n\t}\n\n\tpublic resetTree(\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst reset = new WizardTreeStateBuilder<Step, Category, Branch>(tree).getResetTree();\n\n\t\treturn new WizardTreeStateBuilder<Step, Category, Branch>(reset, tree.activeBranch.id)\n\t\t\t.activateStep(reset.activeCategory.firstStep.id)\n\t\t\t.build();\n\t}\n\n\tpublic showCategory(\n\t\tcategoryId: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeBranch } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst activeCategoryIndex = activeBranch.categories.indexOf(activeBranch.activeCategory);\n\t\tconst categoryIndex = activeBranch.categories.findIndex(category => category.id === categoryId);\n\t\tconst isBeforeActiveCategory = activeCategoryIndex > categoryIndex;\n\n\t\tbuilder.showCategory(categoryId);\n\t\tif (isBeforeActiveCategory) builder.skipCategory(categoryId);\n\n\t\treturn builder.build();\n\t}\n\n\tpublic showStep(\n\t\tstep: Step,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeCategory, lastActiveStep, stepMap } = tree;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tconst stepState = stepMap[step];\n\t\tconst isInActiveCategory = activeCategory.steps.some(s => s.id === step);\n\t\tconst isBeforeLastActiveStep = lastActiveStep.htmlIndex > stepState.htmlIndex;\n\n\t\tbuilder.showStep(step);\n\n\t\tif (isBeforeLastActiveStep) builder.completeStep(step);\n\t\tif (isInActiveCategory && isBeforeLastActiveStep) builder.activateStep(step);\n\n\t\treturn builder.build();\n\t}\n\n\tpublic skipCategory(\n\t\tcategory: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>> = this.currentTree()\n\t): WizardStateResult<Step, Category, Branch> {\n\t\tconst { activeBranch } = tree;\n\t\tconst { activeCategory, nextCategory } = activeBranch;\n\t\tconst builder = new WizardTreeStateBuilder<Step, Category, Branch>(tree);\n\n\t\tbuilder.skipCategory(category);\n\n\t\tif (activeCategory.id === category && nextCategory) {\n\t\t\treturn builder.deactivateCategory(category).activateCategory(nextCategory.id).build();\n\t\t}\n\t\tif (activeCategory.id === category && !nextCategory) {\n\t\t\treturn builder.buildComplete();\n\t\t}\n\t\treturn builder.build();\n\t}\n\n\tprivate currentTree(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\treturn this.wizardStore.getTreeSnapshot();\n\t}\n\n\tprivate projectShownCategory(\n\t\tcategoryId: Category,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeBranch } = tree;\n\t\tconst result =\n\t\t\tcategoryId === activeBranch.firstCategory.id ? this.nextCategory(null, tree) : this.prevCategory(tree);\n\n\t\treturn result as Readonly<IWizardTreeState<Step, Category, Branch>>;\n\t}\n\n\tprivate projectShownStep(\n\t\tstep: Step,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tconst { activeBranch, activeCategory, stepMap } = tree;\n\t\tconst stepState = stepMap[step];\n\n\t\tconst isFirstCategory = stepState.categoryId === activeBranch.firstCategory.id;\n\t\tconst isFirstStep = step === activeCategory.firstStep.id;\n\n\t\tconst result = isFirstCategory && isFirstStep ? this.next(null, tree) : this.prev(tree);\n\n\t\t// projectShownStep is only called when projection is required for an active step.\n\t\t// Result must be a non-terminal tree (otherwise the wizard would have completed/exited).\n\t\treturn result as Readonly<IWizardTreeState<Step, Category, Branch>>;\n\t}\n}\n","import type { IWizardTreeState } from '../../state';\n\n/**\n * Minimal structural shape of `WizardConfig` used by the completed-progress\n * strategy for its `isBackResetCompleted` interaction warning.\n */\nexport interface IWizardProgressConfigLike {\n\treadonly isBackResetCompleted: boolean;\n}\n\n/**\n * Minimal structural shape of `WizardLog` used by the completed-progress\n * strategy to surface a configuration warning.\n */\nexport interface IWizardProgressLogLike {\n\terror(error: Error): void;\n}\n\n/**\n * Strategy for calculating wizard progress (per-category percentage 0-100).\n */\nexport abstract class WizardProgressStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> {\n\tpublic abstract getProgress(tree: Readonly<IWizardTreeState<Step, Category, Branch>>): Record<Category, number>;\n}\n","import type { IWizardTreeState } from '../../state';\n\nimport { WizardProgressStrategy } from './wizard-progress.strategy';\n\n/**\n * Default progress strategy: progress to the last active step of each category.\n * Past categories report 100; future ones report 0; the active category reports\n * `(activeSteps.length - 1) * 100 / shownSteps.length`.\n */\nexport class WizardActiveProgressStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardProgressStrategy<Step, Category, Branch> {\n\tpublic override getProgress(tree: Readonly<IWizardTreeState<Step, Category, Branch>>): Record<Category, number> {\n\t\tconst { activeCategory, categoryMap } = tree;\n\t\tconst progress = {} as Record<Category, number>;\n\n\t\tfor (const category of Object.keys(categoryMap) as Category[]) {\n\t\t\tconst categoryState = categoryMap[category];\n\n\t\t\tif (categoryState.htmlIndex !== activeCategory.htmlIndex) {\n\t\t\t\tprogress[category] = categoryState.htmlIndex < activeCategory.htmlIndex ? 100 : 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tprogress[category] =\n\t\t\t\tcategoryState.shownSteps.length > 0\n\t\t\t\t\t? ((categoryState.activeSteps.length - 1) * 100) / categoryState.shownSteps.length\n\t\t\t\t\t: 0;\n\t\t}\n\n\t\treturn progress;\n\t}\n}\n","import type { WizardNavigation } from '../../navigation/wizard-navigation';\n\nimport { projectToTree } from '../../state';\n\n/**\n * Where the wizard should scroll. Accepts an element directly, a React-style\n * ref object, or a getter — the last two resolve lazily, which is required\n * when the container lives behind a ref (refs are populated after the engine\n * is built). When omitted, the strategy scrolls the page (`window`).\n */\nexport type WizardScrollContainer =\n\t| (() => HTMLElement | null)\n\t| HTMLElement\n\t| null\n\t| { readonly current: HTMLElement | null };\n\n/**\n * Strategy for scrolling between steps in the wizard.\n *\n * Backed by native `Element.scrollIntoView({ behavior, block })`. Smooth/instant\n * variants ship as separate strategies. A scroll container can be attached via\n * `setContainer` (typically by the engine, fed from `withScrollContainer`); the\n * container takes over scroll-to-top from `window`. Step-anchored scrolls keep\n * using `scrollIntoView`, which already walks up to the nearest scrollable\n * ancestor, so the container does not need to be re-resolved per element.\n */\nexport abstract class WizardScrollStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> {\n\t// Thin re-export so subclasses keep the existing call site.\n\tprotected static projectToTree = projectToTree;\n\n\tprotected container?: WizardScrollContainer;\n\n\t/** Called by the navigation pipeline after `setState` lands a new tree. */\n\tpublic abstract onNavigate(navigation: WizardNavigation<Step, Category, Branch>): Promise<boolean>;\n\n\t/** Called when toggling step/category visibility (instant scroll by default). */\n\tpublic onToggle(navigation: WizardNavigation<Step, Category, Branch>): Promise<boolean> {\n\t\tconst tree = projectToTree(navigation.to);\n\t\tif (!tree) return Promise.resolve(false);\n\n\t\tconst isFirstStepOfCategory = tree.lastActiveStep?.id === tree.activeCategory.firstStep?.id;\n\t\treturn scrollToStep(isFirstStepOfCategory ? null : tree.lastActiveStep?.id, 'auto', this.container);\n\t}\n\n\t/**\n\t * Imperative scroll-to-top of the configured container (or window). Useful\n\t * for surfacing top-of-page state — e.g. an error banner — after a failed\n\t * submit, without re-running the navigation pipeline.\n\t */\n\tpublic scrollToTop(behavior: 'auto' | 'smooth' = 'smooth'): Promise<boolean> {\n\t\treturn scrollToStep(null, behavior, this.container);\n\t}\n\n\tpublic setContainer(container?: WizardScrollContainer): void {\n\t\tthis.container = container;\n\t}\n}\n\n/**\n * Internal helper: scroll to a step by element id (or to the top for `null`).\n * SSR-safe (no-op when `document` is unavailable). Honors `prefers-reduced-motion`\n * by silently downgrading 'smooth' to 'auto'. When `container` is provided, the\n * scroll-to-top case targets that element instead of `window`.\n */\nexport function scrollToStep(\n\tstepId: null | string | undefined,\n\tbehavior: 'auto' | 'instant' | 'smooth',\n\tcontainer?: WizardScrollContainer\n): Promise<boolean> {\n\tif (typeof document === 'undefined') return Promise.resolve(false);\n\n\tconst reducedMotion =\n\t\ttypeof window !== 'undefined' && typeof window.matchMedia === 'function'\n\t\t\t? window.matchMedia('(prefers-reduced-motion: reduce)').matches\n\t\t\t: false;\n\tconst effectiveBehavior: 'auto' | 'instant' | 'smooth' = reducedMotion ? 'auto' : behavior;\n\n\tif (!stepId) {\n\t\tconst containerEl = resolveScrollContainer(container);\n\t\tif (containerEl) {\n\t\t\tcontainerEl.scrollTo({ behavior: effectiveBehavior, top: 0 });\n\t\t} else if (typeof window !== 'undefined') {\n\t\t\twindow.scrollTo({ behavior: effectiveBehavior, top: 0 });\n\t\t}\n\t\treturn Promise.resolve(true);\n\t}\n\n\tconst element = document.getElementById(stepId);\n\tif (!element) return Promise.resolve(false);\n\n\telement.scrollIntoView({ behavior: effectiveBehavior, block: 'start' });\n\treturn Promise.resolve(true);\n}\n\nfunction resolveScrollContainer(c: undefined | WizardScrollContainer): HTMLElement | null {\n\tif (!c) return null;\n\tif (typeof c === 'function') return c();\n\tif ('current' in c) return c.current;\n\treturn c;\n}\n","import type { WizardNavigation } from '../../navigation/wizard-navigation';\n\nimport { scrollToStep, WizardScrollStrategy } from './wizard-scroll.strategy';\n\n/**\n * Minimal structural shape of `WizardConfig` used by the smooth scroll strategy.\n * Phase 7 replaces this with the concrete class.\n */\nexport interface IWizardScrollConfigLike {\n\treadonly isMobile: boolean;\n}\n\n/**\n * Smooth-scroll strategy. Scrolls to the active step on every navigation;\n * downgrades to instant scroll on category transitions, on mobile, and when\n * `prefers-reduced-motion: reduce` is set.\n */\nexport class WizardSmoothScrollStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardScrollStrategy<Step, Category, Branch> {\n\tconstructor(private readonly wizardConfig?: IWizardScrollConfigLike) {\n\t\tsuper();\n\t}\n\n\tpublic override onNavigate(navigation: WizardNavigation<Step, Category, Branch>): Promise<boolean> {\n\t\tconst tree = WizardScrollStrategy.projectToTree(navigation.to);\n\t\tif (!tree) return Promise.resolve(false);\n\n\t\tconst isFirstStepOfCategory = tree.lastActiveStep?.id === tree.activeCategory.firstStep?.id;\n\t\tconst stepId = isFirstStepOfCategory ? null : tree.lastActiveStep?.id;\n\n\t\tconst useInstant = navigation.isCategoryChanging || (this.wizardConfig?.isMobile ?? false);\n\t\treturn scrollToStep(stepId, useInstant ? 'auto' : 'smooth', this.container);\n\t}\n}\n","import type { IWizardStepState, IWizardTreeState } from '../../state';\n\n/**\n * Minimal structural shape of `WizardConfig` used by visibility strategies.\n * Phase 7 replaces this with the concrete class.\n */\nexport interface IWizardVisibilityConfigLike {\n\treadonly isMobile: boolean;\n}\n\n/**\n * Strategy for calculating which wizard steps are visible (mounted in the DOM).\n */\nexport abstract class WizardVisibilityStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> {\n\tpublic abstract isStepVisible(\n\t\tstep: IWizardStepState<Step, Category, Branch>,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): boolean;\n}\n","import type { IWizardStepState, IWizardTreeState } from '../../state';\n\nimport { type IWizardVisibilityConfigLike, WizardVisibilityStrategy } from './wizard-visibility.strategy';\n\n/**\n * Default visibility: show all active steps of the active category on desktop;\n * show only the last active step on mobile.\n */\nexport class WizardDefaultVisibilityStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardVisibilityStrategy<Step, Category, Branch> {\n\tconstructor(private readonly wizardConfig: IWizardVisibilityConfigLike) {\n\t\tsuper();\n\t}\n\n\tpublic override isStepVisible(\n\t\tstep: IWizardStepState<Step, Category, Branch>,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): boolean {\n\t\tconst isShowStep = step.isActive && step.isShow;\n\t\tconst isLastActiveStep = step.id === tree.lastActiveStep?.id;\n\n\t\treturn this.wizardConfig.isMobile ? isShowStep && isLastActiveStep : isShowStep;\n\t}\n}\n","import type { IWizardStepState, IWizardTreeState } from '../../state';\n\nimport { WizardVisibilityStrategy } from './wizard-visibility.strategy';\n\n/**\n * Show only the last active step of the category.\n */\nexport class WizardLastActiveVisibilityStrategy<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends WizardVisibilityStrategy<Step, Category, Branch> {\n\tpublic override isStepVisible(\n\t\tstep: IWizardStepState<Step, Category, Branch>,\n\t\ttree: Readonly<IWizardTreeState<Step, Category, Branch>>\n\t): boolean {\n\t\tconst isShowStep = step.isActive && step.isShow;\n\t\tconst isLastActiveStep = step.id === tree.lastActiveStep?.id;\n\n\t\treturn isShowStep && isLastActiveStep;\n\t}\n}\n","import type { IWizardConfigOptions, IWizardResolverHook } from '../interfaces';\n\n/**\n * English defaults for `IWizardConfigOptions`. Consumers override locale-sensitive\n * fields via `<WizardProvider config={{ nextBtnText: t\\`Next\\` }}>` in the React\n * adapter (Phase 15), so the framework-free core never depends on Lingui.\n */\nconst passResolver: IWizardResolverHook<string, string, string> = () => true;\n\nexport const wizardDefaultConfig: IWizardConfigOptions = {\n\tbackBtnClass: '',\n\tbackBtnText: 'Back',\n\n\tdoneDotText: 'Finish',\n\tenableTracing: 'none',\n\n\tfinishText: 'Finish',\n\theaderI18n: null,\n\tisActiveCategoryClickReset: true,\n\tisBackResetCompleted: true,\n\tisDoneDot: false,\n\n\tisShowFirstStepOnCategoryChange: false,\n\tisShowWizardHeader: true,\n\n\tisShowWizardHeaderSteps: true,\n\tnextBtnClass: '',\n\tnextBtnText: 'Next',\n\tnextCategoryText: 'Continue',\n\tresolveCategoryChange: passResolver,\n\tresolveCategoryComplete: passResolver,\n\n\tresolveCategoryEnter: passResolver,\n\tresolveStepChange: passResolver,\n\tsilenceErrors: false,\n\tstickyHeader: true,\n};\n","import type { IWizardConfigOptions } from '../interfaces';\n\nimport { wizardDefaultConfig } from './wizard-default.config';\n\ntype ConfigListener<Category extends string> = (config: Readonly<IWizardConfigOptions<Category>>) => void;\n\n/**\n * Holds the merged wizard config and notifies subscribers on change.\n *\n * Multiple `setOptions` calls within one microtask coalesce into a single\n * notification.\n */\nexport class WizardConfig<Category extends string = string> {\n\t/**\n\t * Whether the wizard is rendering on a mobile viewport. Used by the default\n\t * visibility and scroll strategies. The React adapter (Phase 15) updates this\n\t * via a media-query subscription; in plain Node (tests/SSR), it stays `false`.\n\t */\n\tpublic isMobile = false;\n\tpublic get options(): Readonly<IWizardConfigOptions<Category>> {\n\t\treturn this.current;\n\t}\n\tprivate current: IWizardConfigOptions<Category>;\n\tprivate disposed = false;\n\tprivate readonly listeners = new Set<ConfigListener<Category>>();\n\n\tprivate notifyScheduled = false;\n\n\tconstructor(overrides: Partial<IWizardConfigOptions<Category>> = {}) {\n\t\tthis.current = { ...(wizardDefaultConfig as IWizardConfigOptions<Category>), ...overrides };\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.listeners.clear();\n\t}\n\n\tpublic getOptions(): Readonly<IWizardConfigOptions<Category>> {\n\t\treturn this.current;\n\t}\n\n\tpublic setOptions(options: Partial<IWizardConfigOptions<Category>>): this {\n\t\tif (this.disposed) return this;\n\n\t\tlet changed = false;\n\t\tfor (const k of Object.keys(options) as Array<keyof IWizardConfigOptions<Category>>) {\n\t\t\tif (!Object.is(options[k], this.current[k])) {\n\t\t\t\tchanged = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!changed) return this;\n\n\t\tthis.current = { ...this.current, ...options };\n\t\tthis.scheduleNotify();\n\t\treturn this;\n\t}\n\n\tpublic subscribe(listener: ConfigListener<Category>): () => void {\n\t\tif (this.disposed) return () => {};\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\tprivate scheduleNotify(): void {\n\t\tif (this.notifyScheduled) return;\n\t\tthis.notifyScheduled = true;\n\n\t\tqueueMicrotask(() => {\n\t\t\tthis.notifyScheduled = false;\n\t\t\tif (this.disposed) return;\n\n\t\t\tconst snapshot = this.current;\n\t\t\tfor (const listener of [...this.listeners]) {\n\t\t\t\tlistener(snapshot);\n\t\t\t}\n\t\t});\n\t}\n}\n","import type { IWizardConfigOptions } from '../interfaces';\n\nimport { WizardError } from './errors';\n\n/**\n * Minimal structural shape of `WizardConfig` consumed by `WizardLog` —\n * it reads `enableTracing` and `silenceErrors` only. Phase 7's `WizardConfig`\n * class structurally satisfies this interface (it exposes `getOptions()`).\n */\nexport interface IWizardLogConfigLike {\n\tgetOptions(): Pick<IWizardConfigOptions, 'enableTracing' | 'silenceErrors'>;\n}\n\n/**\n * Console-based logger. Respects `config.enableTracing` for `trace()` and\n * `config.silenceErrors` for `WizardError` instances.\n */\nexport class WizardLog {\n\tconstructor(private readonly wizardConfig: IWizardLogConfigLike) {}\n\n\tpublic error(e: unknown): void {\n\t\tif (!(e instanceof WizardError)) {\n\t\t\tconsole.error(e);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.wizardConfig.getOptions().silenceErrors) {\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.error(e);\n\t}\n\n\tpublic trace(...args: unknown[]): void {\n\t\tif (this.wizardConfig.getOptions().enableTracing !== 'none') {\n\t\t\tconsole.log(...args);\n\t\t}\n\t}\n}\n","import type { IWizardTreeState } from './state';\n\nimport { WizardInitializationError } from './errors';\nimport { getShapeId } from './utils';\n\ntype StoreListener = () => void;\n\n/**\n * Holds the current wizard tree, exposes a `useSyncExternalStore`-shaped\n * subscription, and gates `setState` calls behind `init()`.\n */\nexport class WizardStore<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic readonly initOnce: Promise<Readonly<IWizardTreeState<Step, Category, Branch>>>;\n\tpublic get shapeId(): string {\n\t\treturn this._shapeId ?? '';\n\t}\n\tprivate _shapeId: null | string = null;\n\tprivate current: null | Readonly<IWizardTreeState<Step, Category, Branch>> = null;\n\tprivate disposed = false;\n\n\tprivate initialTree: null | Readonly<IWizardTreeState<Step, Category, Branch>> = null;\n\n\tprivate readonly listeners = new Set<StoreListener>();\n\n\tprivate resolveInitOnce!: (tree: Readonly<IWizardTreeState<Step, Category, Branch>>) => void;\n\n\tconstructor(private readonly storagePrefix?: number | string) {\n\t\tthis.initOnce = new Promise(resolve => {\n\t\t\tthis.resolveInitOnce = resolve;\n\t\t});\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.listeners.clear();\n\t}\n\n\tpublic getTreeSnapshot(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\tif (!this.current) {\n\t\t\tthrow new WizardInitializationError('[WizardStore] getTreeSnapshot called before init');\n\t\t}\n\t\treturn this.current;\n\t}\n\n\tpublic init(initialTree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\tif (this.disposed) return;\n\n\t\tif (this.initialTree) {\n\t\t\t// Idempotent — log via console for now; the engine emits a NavigationIgnored later\n\n\t\t\tconsole.warn('[WizardStore] init() called more than once; ignoring subsequent call.');\n\t\t\treturn;\n\t\t}\n\n\t\tthis.initialTree = initialTree;\n\t\tthis._shapeId = getShapeId(initialTree.state, this.storagePrefix);\n\t\tthis.setState(initialTree);\n\t\tthis.resolveInitOnce(initialTree);\n\t}\n\n\tpublic setState(tree: Readonly<IWizardTreeState<Step, Category, Branch>>): void {\n\t\tif (this.disposed) return;\n\n\t\tif (!this.initialTree) {\n\t\t\tthrow new WizardInitializationError('[WizardStore] setState called before init');\n\t\t}\n\n\t\tif (this.current === tree) return;\n\n\t\tthis.current = tree;\n\t\tfor (const listener of [...this.listeners]) {\n\t\t\tlistener();\n\t\t}\n\t}\n\n\tpublic subscribe = (listener: StoreListener): (() => void) => {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t};\n}\n","import type { IWizardConfigOptions } from '../interfaces';\nimport type { WizardEvent } from './events/wizard-events';\nimport type { WizardInitializer } from './initializers';\nimport type { WizardListener } from './listeners';\nimport type { IWizardStepState, IWizardTreeState } from './state';\nimport type {\n\tWizardProgressStrategy,\n\tWizardScrollContainer,\n\tWizardScrollStrategy,\n\tWizardVisibilityStrategy,\n} from './strategies';\n\nimport { WizardDefaultInitializer } from './initializers';\nimport { WizardInitializerService } from './navigation/initializer-service';\nimport { WizardNavigationService } from './navigation/navigation-service';\nimport { WizardStateService } from './navigation/state-service';\nimport {\n\tWizardActiveProgressStrategy,\n\tWizardDefaultVisibilityStrategy,\n\tWizardSmoothScrollStrategy,\n} from './strategies';\nimport { WizardConfig } from './wizard-config';\nimport { WizardLog } from './wizard-log';\nimport { WizardStore } from './wizard-store';\n\nexport interface WizardEngineOptions<Step extends string, Category extends string, Branch extends string = string> {\n\tactiveBranch?: Branch;\n\tconfig?: Partial<IWizardConfigOptions<Category>>;\n\tinitializers?: ReadonlyArray<WizardInitializer<Step, Category, Branch>>;\n\tlisteners?: ReadonlyArray<WizardListener<Step, Category, Branch>>;\n\tscrollContainer?: WizardScrollContainer;\n\tstate: ReadonlyArray<WizardEngineStepRegistration<Step, Category, Branch>>;\n\tstrategies?: WizardEngineStrategies<Step, Category, Branch>;\n}\n\n/**\n * Step-shape descriptor passed to the engine when constructing it. The full\n * `WizardStep` per-step UI control object lives in the React adapter (Phase 15);\n * the engine itself only needs the flat per-step state plus the categoryId so\n * it can build a tree.\n */\nexport type WizardEngineStepRegistration<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> = IWizardStepState<Step, Category, Branch>;\n\nexport interface WizardEngineStrategies<Step extends string, Category extends string, Branch extends string = string> {\n\tprogress?: WizardProgressStrategy<Step, Category, Branch>;\n\tscroll?: WizardScrollStrategy<Step, Category, Branch>;\n\tvisibility?: WizardVisibilityStrategy<Step, Category, Branch>;\n}\n\n/**\n * Top-level wizard façade. Framework-free: pass plain objects in, subscribe via\n * `subscribe()` / `on()`, control via the imperative methods.\n */\nexport class WizardEngine<Step extends string, Category extends string, Branch extends string = string> {\n\tpublic get configOptions(): Readonly<IWizardConfigOptions<Category>> {\n\t\treturn this.config.options;\n\t}\n\tpublic get isInitialized(): boolean {\n\t\treturn this.initialized;\n\t}\n\tpublic get lastActiveStep(): IWizardStepState<Step, Category, Branch> {\n\t\treturn this.tree.lastActiveStep;\n\t}\n\tpublic get progress(): Record<Category, number> {\n\t\treturn this.progressStrategy.getProgress(this.tree);\n\t}\n\tpublic get shapeId(): string {\n\t\treturn this.store.shapeId;\n\t}\n\tpublic get steps(): Readonly<Record<Step, IWizardStepState<Step, Category, Branch>>> {\n\t\treturn this.tree.stepMap;\n\t}\n\tpublic get tree(): Readonly<IWizardTreeState<Step, Category, Branch>> {\n\t\treturn this.store.getTreeSnapshot();\n\t}\n\tprivate committed = false; // commitRegistration() entered\n\tprivate readonly config: WizardConfig<Category>;\n\n\tprivate disposed = false;\n\tprivate readonly initialBranch?: Branch;\n\tprivate initialized = false; // store.init() ran successfully\n\n\tprivate readonly initialState: ReadonlyArray<WizardEngineStepRegistration<Step, Category, Branch>>;\n\tprivate readonly initService: WizardInitializerService<Step, Category, Branch>;\n\tprivate readonly listeners: ReadonlyArray<WizardListener<Step, Category, Branch>>;\n\n\tprivate readonly log: WizardLog;\n\n\t// ------------- snapshots -------------\n\n\tprivate readonly navService: WizardNavigationService<Step, Category, Branch>;\n\n\tprivate readonly pendingPostInitTasks: Array<{\n\t\treadonly resolve: (value: boolean) => void;\n\t\treadonly run: () => void;\n\t}> = [];\n\n\tprivate readonly progressStrategy: WizardProgressStrategy<Step, Category, Branch>;\n\n\tprivate readonly scrollStrategy: WizardScrollStrategy<Step, Category, Branch>;\n\n\tprivate readonly stateService: WizardStateService<Step, Category, Branch>;\n\n\tprivate readonly store: WizardStore<Step, Category, Branch>;\n\n\tprivate readonly visibilityStrategy: WizardVisibilityStrategy<Step, Category, Branch>;\n\n\tconstructor(options: WizardEngineOptions<Step, Category, Branch>) {\n\t\tthis.config = new WizardConfig<Category>(options.config ?? {});\n\t\tconst storagePrefix = (options.config?.storagePrefix ?? undefined) as number | string | undefined;\n\t\tthis.store = new WizardStore<Step, Category, Branch>(storagePrefix);\n\t\tthis.log = new WizardLog(this.config);\n\n\t\tthis.scrollStrategy =\n\t\t\toptions.strategies?.scroll ?? new WizardSmoothScrollStrategy<Step, Category, Branch>(this.config);\n\t\tif (options.scrollContainer !== undefined) {\n\t\t\tthis.scrollStrategy.setContainer(options.scrollContainer);\n\t\t}\n\t\tthis.visibilityStrategy =\n\t\t\toptions.strategies?.visibility ?? new WizardDefaultVisibilityStrategy<Step, Category, Branch>(this.config);\n\t\tthis.progressStrategy =\n\t\t\toptions.strategies?.progress ?? new WizardActiveProgressStrategy<Step, Category, Branch>();\n\n\t\tthis.stateService = new WizardStateService<Step, Category, Branch>(this.store, this.config);\n\t\tthis.navService = new WizardNavigationService<Step, Category, Branch>(\n\t\t\tthis.store,\n\t\t\tthis.config,\n\t\t\tthis.stateService,\n\t\t\tthis.scrollStrategy\n\t\t);\n\n\t\tconst initializers = options.initializers ?? [new WizardDefaultInitializer<Step, Category, Branch>()];\n\t\tthis.initService = new WizardInitializerService<Step, Category, Branch>(this.log, initializers);\n\n\t\tthis.listeners = options.listeners ?? [];\n\t\tthis.initialState = options.state;\n\t\tthis.initialBranch = options.activeBranch;\n\t}\n\n\t// ------------- React adapter wiring -------------\n\n\tpublic back(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.prev()));\n\t}\n\tpublic backCategory(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.prevCategory()));\n\t}\n\n\tpublic async commitRegistration(): Promise<void> {\n\t\tif (this.disposed) return;\n\t\tif (this.committed) return;\n\t\tthis.committed = true;\n\n\t\tconst tree = await this.initService.getInitialState(this.initialState, this.initialBranch);\n\n\t\t// React 19 Strict Mode can dispose the engine while we're awaiting the\n\t\t// initializer chain. Bail out before touching the store/listeners — but\n\t\t// drain queued tasks so callers' awaits resolve to `false` rather than\n\t\t// hanging forever.\n\t\tif (this.disposed) {\n\t\t\tfor (const task of this.pendingPostInitTasks.splice(0)) task.resolve(false);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.store.init(tree);\n\t\tthis.initialized = true;\n\n\t\t// Fan-out onInit to listeners (after store is ready so listener handlers\n\t\t// that read engine state see the live tree)\n\t\tfor (const listener of this.listeners) {\n\t\t\ttry {\n\t\t\t\tlistener.onInit(tree);\n\t\t\t} catch (e) {\n\t\t\t\tthis.log.error(e);\n\t\t\t}\n\t\t}\n\n\t\t// Wire onTreeChange to store updates\n\t\tthis.store.subscribe(() => {\n\t\t\tconst current = this.store.getTreeSnapshot();\n\t\t\tfor (const listener of this.listeners) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener.onTreeChange(current);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.log.error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// Wire onEvent to nav service\n\t\tthis.navService.on('*', event => {\n\t\t\tfor (const listener of this.listeners) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener.onEvent(event);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.log.error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// Drain any navigations queued before commit (init-queue pattern)\n\t\tfor (const task of this.pendingPostInitTasks.splice(0)) {\n\t\t\ttask.run();\n\t\t}\n\t}\n\n\t// ------------- bootstrap -------------\n\n\tpublic completeWizard(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.completeWizard());\n\t}\n\n\t// ------------- imperative API -------------\n\n\tpublic dispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\n\t\t// Drain any tasks queued during a never-finished commit so callers'\n\t\t// promises resolve to `false` instead of leaking.\n\t\tfor (const task of this.pendingPostInitTasks.splice(0)) task.resolve(false);\n\n\t\t// `committed` may be true while `initialized` is still false if dispose\n\t\t// fires while `commitRegistration()` is awaiting the initializer chain\n\t\t// (React 19 Strict Mode double-mount triggers this).\n\t\tconst lastTree = this.initialized ? this.store.getTreeSnapshot() : null;\n\t\tfor (const listener of this.listeners) {\n\t\t\ttry {\n\t\t\t\tlistener.onDestroy(lastTree as Readonly<IWizardTreeState<Step, Category, Branch>>);\n\t\t\t} catch (e) {\n\t\t\t\tthis.log.error(e);\n\t\t\t}\n\t\t}\n\n\t\tthis.navService.dispose();\n\t\tthis.store.dispose();\n\t\tthis.config.dispose();\n\t}\n\n\tpublic exitWizard(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.exitWizard());\n\t}\n\n\tpublic getTreeSnapshot = (): Readonly<IWizardTreeState<Step, Category, Branch>> => this.store.getTreeSnapshot();\n\n\tpublic go(tree: Readonly<IWizardTreeState<Step, Category, Branch>>): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(tree));\n\t}\n\n\tpublic goToCategory(category: Category): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.goToCategory(category)));\n\t}\n\n\tpublic hideCategory(category: Category): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.hideCategory(category));\n\t}\n\n\tpublic hideStep(step: Step | Step[]): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.hideStep(step));\n\t}\n\n\tpublic isStepVisible(stepId: Step): boolean {\n\t\tconst tree = this.store.getTreeSnapshot();\n\t\tconst step = tree.stepMap[stepId];\n\t\tif (!step) return false;\n\t\treturn this.visibilityStrategy.isStepVisible(step, tree);\n\t}\n\n\tpublic next(branch?: Branch | null): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.next(branch ?? null)));\n\t}\n\n\tpublic nextCategory(branch?: Branch | null): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.nextCategory(branch ?? null)));\n\t}\n\n\tpublic on(\n\t\ttype: '*' | WizardEvent<Step, Category, Branch>['type'],\n\t\thandler: (event: WizardEvent<Step, Category, Branch>) => void\n\t): () => void {\n\t\treturn this.navService.on(type, handler);\n\t}\n\n\tpublic resetActiveCategory(from = 0): Promise<boolean> {\n\t\treturn this.runOrQueue(() =>\n\t\t\tthis.navService.navigate(this.stateService.resetCategory(this.tree.activeCategory.id, from))\n\t\t);\n\t}\n\n\tpublic resetCategory(category: Category, from = 0): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.resetCategory(category, from)));\n\t}\n\n\tpublic resetWizard(): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.navigate(this.stateService.resetTree()));\n\t}\n\n\tpublic scrollToTop(behavior: 'auto' | 'smooth' = 'smooth'): Promise<boolean> {\n\t\treturn this.scrollStrategy.scrollToTop(behavior);\n\t}\n\n\tpublic showCategory(category: Category): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.showCategory(category));\n\t}\n\n\tpublic showStep(step: Step | Step[]): Promise<boolean> {\n\t\treturn this.runOrQueue(() => this.navService.showStep(step));\n\t}\n\n\tpublic skipActiveCategory(): Promise<boolean> {\n\t\treturn this.runOrQueue(() =>\n\t\t\tthis.navService.navigate(this.stateService.skipCategory(this.tree.activeCategory.id))\n\t\t);\n\t}\n\n\tpublic skipCategory(category?: Category): Promise<boolean> {\n\t\treturn this.runOrQueue(() =>\n\t\t\tthis.navService.navigate(this.stateService.skipCategory(category ?? this.tree.activeCategory.id))\n\t\t);\n\t}\n\n\tpublic subscribe = (listener: () => void): (() => void) => this.store.subscribe(listener);\n\n\tpublic toggleCategory(category: Category, show: boolean): Promise<boolean> {\n\t\treturn show ? this.showCategory(category) : this.hideCategory(category);\n\t}\n\n\t// ------------- lifecycle -------------\n\n\tpublic toggleStep(step: Step | Step[], show: boolean): Promise<boolean> {\n\t\treturn show ? this.showStep(step) : this.hideStep(step);\n\t}\n\n\t// ------------- internal -------------\n\n\tprivate runOrQueue(action: () => Promise<boolean>): Promise<boolean> {\n\t\tif (this.disposed) {\n\t\t\treturn Promise.resolve(false);\n\t\t}\n\t\t// Queue until the store is actually populated — `committed` flips to true\n\t\t// synchronously inside `commitRegistration` but `initialized` only flips\n\t\t// after the initializer chain settles.\n\t\tif (!this.initialized) {\n\t\t\treturn new Promise<boolean>((resolve, reject) => {\n\t\t\t\tthis.pendingPostInitTasks.push({\n\t\t\t\t\tresolve,\n\t\t\t\t\trun: () => {\n\t\t\t\t\t\taction().then(resolve, reject);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t\treturn action();\n\t}\n}\n","export enum WizardCategoryDirection {\n\tBackward = 'backward',\n\tForward = 'forward',\n}\n","'use client';\n\nimport { Slot } from '@radix-ui/react-slot';\nimport { type ReactNode } from 'react';\n\nimport { type IWizardButtonProps, useWizardComponents } from '../components-provider';\n\ninterface IWizardActionButtonProps {\n\tasChild?: boolean;\n\tchildren?: ReactNode;\n\tclassName?: string;\n\tdefaultLabel: ReactNode;\n\tonClick: () => void;\n\tvariant?: IWizardButtonProps['variant'];\n}\n\n/**\n * Internal scaffold shared by `WizardBack` and `WizardNext`. Renders the\n * Button injected via `WizardComponentsProvider`, or wraps children in a\n * Radix `Slot` when `asChild` is set so the consumer's element receives\n * the click + className.\n */\nexport function WizardActionButton(props: IWizardActionButtonProps) {\n\tconst { Button } = useWizardComponents();\n\n\tif (props.asChild) {\n\t\treturn (\n\t\t\t<Slot className={props.className} onClick={props.onClick}>\n\t\t\t\t{props.children}\n\t\t\t</Slot>\n\t\t);\n\t}\n\treturn (\n\t\t<Button className={props.className} onClick={props.onClick} type=\"button\" variant={props.variant}>\n\t\t\t{props.children ?? props.defaultLabel}\n\t\t</Button>\n\t);\n}\n","'use client';\n\nimport { type ReactNode } from 'react';\n\nimport { useWizard } from '../use-wizard';\nimport { WizardActionButton } from './wizard-action-button';\n\ninterface IWizardBackComponentProps {\n\tasChild?: boolean;\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\n/**\n * Back button. Calls `wizard.back()` on click. Wrap a custom button via\n * `asChild` to compose with shadcn variants.\n */\nexport function WizardBack(props: IWizardBackComponentProps) {\n\tconst wizard = useWizard();\n\treturn (\n\t\t<WizardActionButton\n\t\t\tasChild={props.asChild}\n\t\t\tclassName={props.className}\n\t\t\tdefaultLabel={wizard.configOptions.backBtnText ?? 'Back'}\n\t\t\tonClick={() => void wizard.back()}\n\t\t\tvariant=\"ghost\"\n\t\t>\n\t\t\t{props.children}\n\t\t</WizardActionButton>\n\t);\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\n\nimport { useWizard } from '../use-wizard';\n\ninterface IWizardCategoryComponentProps<Category extends string> {\n\tcategoryId: Category;\n\tchildren: ReactNode;\n}\n\n/**\n * Wrapper that renders its children only while the named category is active.\n */\nexport function WizardCategory<Category extends string>(props: IWizardCategoryComponentProps<Category>) {\n\tconst wizard = useWizard<string, Category>();\n\tif (wizard.tree.activeCategory.id !== props.categoryId) return null;\n\treturn <>{props.children}</>;\n}\n","'use client';\n\nimport { cn } from '~/utils/cn';\nimport { CheckIcon } from 'lucide-react';\n\nexport type WizardStepperDotState = 'active' | 'completed' | 'pending' | 'skipped';\n\ninterface IWizardStepperDotProps {\n\tclickable?: boolean;\n\tisLast?: boolean;\n\tlabel?: string;\n\tonClick?: () => void;\n\tprogress: number;\n\tstate: WizardStepperDotState;\n}\n\n/**\n * Single dot in `WizardStepper`. Renders a 12px circle with a trailing track\n * fill (sized by `progress` 0-100) unless `isLast`. Optional label sits above.\n *\n * Visual states map to project semantic status tokens\n * (`success-bg`, `success-text`, `success-border`, `border`, `muted-foreground`).\n */\nexport function WizardStepperDot(props: IWizardStepperDotProps) {\n\tconst { clickable = false, isLast = false, label, onClick, progress, state } = props;\n\tconst isInteractive = clickable && !!onClick;\n\n\treturn (\n\t\t<li className=\"relative flex flex-1 items-center\" data-state={state}>\n\t\t\t<button\n\t\t\t\taria-current={state === 'active' ? 'step' : undefined}\n\t\t\t\taria-label={label ?? state}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'relative flex size-3 shrink-0 items-center justify-center rounded-full border-2 transition-colors',\n\t\t\t\t\tstate === 'pending' && 'border-border bg-background',\n\t\t\t\t\tstate === 'active' &&\n\t\t\t\t\t\t'border-success-text bg-success-text ring-2 ring-success-border/40 ring-offset-2 ring-offset-background',\n\t\t\t\t\tstate === 'completed' && 'border-success-border bg-success-text',\n\t\t\t\t\tstate === 'skipped' && 'border-border bg-background opacity-60',\n\t\t\t\t\tisInteractive && 'cursor-pointer hover:bg-success-bg',\n\t\t\t\t\t!isInteractive && 'cursor-default'\n\t\t\t\t)}\n\t\t\t\tdisabled={!isInteractive}\n\t\t\t\tonClick={isInteractive ? onClick : undefined}\n\t\t\t\ttype=\"button\"\n\t\t\t>\n\t\t\t\t{state === 'completed' && <CheckIcon className=\"size-2 text-background\" />}\n\t\t\t</button>\n\t\t\t{!isLast && (\n\t\t\t\t<span aria-hidden className=\"relative ml-1 mr-1 h-px flex-1 bg-border\">\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"absolute inset-y-0 left-0 bg-success-border transition-[width]\"\n\t\t\t\t\t\tstyle={{ width: `${Math.max(0, Math.min(100, progress))}%` }}\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t{label && (\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'absolute -top-6 left-0 -translate-x-[calc(50%-0.375rem)] text-sm font-semibold whitespace-nowrap',\n\t\t\t\t\t\tstate === 'active' && 'text-success-text',\n\t\t\t\t\t\tstate !== 'active' && 'text-muted-foreground'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</li>\n\t);\n}\n","'use client';\n\nimport type { IWizardCategoryState } from '../../core/state';\n\nimport { WizardStepperDot, type WizardStepperDotState } from './wizard-stepper-dot';\n\ninterface IWizardStepperProps<Category extends string> {\n\tcanAccessCategory?: (category: IWizardCategoryState<string, Category, string>) => boolean;\n\tcategories: ReadonlyArray<IWizardCategoryState<string, Category, string>>;\n\tdoneDot?: { text: string };\n\theaderI18n?: null | Record<Category, string>;\n\tonCategoryClick?: (category: IWizardCategoryState<string, Category, string>) => void;\n\tprogress: Record<Category, number>;\n}\n\n/**\n * Pure-presentational horizontal stepper. Renders one `WizardStepperDot` per\n * category with the per-category progress fill on the trailing track, plus an\n * optional trailing \"done\" dot.\n */\nexport function WizardStepper<Category extends string>(props: IWizardStepperProps<Category>) {\n\tconst { canAccessCategory, categories, doneDot, headerI18n, onCategoryClick, progress } = props;\n\tconst lastIdx = categories.length - 1;\n\n\treturn (\n\t\t<ol aria-label=\"Wizard progress\" className=\"relative flex flex-1 items-center pt-6\">\n\t\t\t{categories.map((category, idx) => {\n\t\t\t\tconst isLast = idx === lastIdx && !doneDot;\n\t\t\t\tconst clickable = canAccessCategory?.(category) ?? false;\n\t\t\t\treturn (\n\t\t\t\t\t<WizardStepperDot\n\t\t\t\t\t\tclickable={clickable}\n\t\t\t\t\t\tisLast={isLast}\n\t\t\t\t\t\tkey={category.id}\n\t\t\t\t\t\tlabel={headerI18n?.[category.id]}\n\t\t\t\t\t\tonClick={onCategoryClick ? () => onCategoryClick(category) : undefined}\n\t\t\t\t\t\tprogress={progress[category.id] ?? 0}\n\t\t\t\t\t\tstate={getDotState(category, progress[category.id] ?? 0)}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t})}\n\t\t\t{doneDot && <WizardStepperDot isLast label={doneDot.text} progress={0} state=\"pending\" />}\n\t\t</ol>\n\t);\n}\n\nfunction getDotState(category: IWizardCategoryState<string, string, string>, progress: number): WizardStepperDotState {\n\tif (category.isActive) return 'active';\n\tif (progress >= 100) return 'completed';\n\tif (category.isSkipped) return 'skipped';\n\treturn 'pending';\n}\n","'use client';\n\nimport { cn } from '~/utils/cn';\n\nimport type { IWizardCategoryState } from '../../core/state';\n\nimport { useWizard } from '../use-wizard';\nimport { WizardBack } from './wizard-back';\nimport { WizardStepper } from './wizard-stepper';\n\n/**\n * Default wizard header — renders an optional back button and the visual\n * stepper. Gates on `config.isShowWizardHeader`, reserves space when the back\n * button is hidden, and forwards click handlers that delegate to\n * `wizard.goToCategory` / `wizard.resetCategory`.\n */\nexport function WizardHeader<Category extends string = string>() {\n\tconst wizard = useWizard<string, Category>();\n\tconst tree = wizard.tree;\n\tconst config = wizard.configOptions;\n\n\tif (!config.isShowWizardHeader) return null;\n\n\t/**\n\t * Per-step header overrides (`isShowBackBtn`, `isShowHeaderSteps` from the\n\t * Angular original) are not part of the React port yet. Both default to true.\n\t */\n\tconst oneCategory = tree.activeBranch.shownCategories.length === 1 && !config.isDoneDot;\n\tconst stepHeaderEnabled = true;\n\tconst showSteps = config.isShowWizardHeaderSteps && stepHeaderEnabled && !oneCategory;\n\n\tconst canAccessCategory = (category: IWizardCategoryState<string, Category, string>): boolean => {\n\t\tif (config.isBackResetCompleted) return false;\n\t\tif (category.isCompleted) return true;\n\t\tconst idx = tree.activeBranch.shownCategories.indexOf(category);\n\t\treturn !!tree.activeBranch.shownCategories[idx - 1]?.isCompleted;\n\t};\n\n\tconst onCategoryClick = (category: IWizardCategoryState<string, Category, string>) => {\n\t\tif (config.isBackResetCompleted) return;\n\t\tconst isCategoryStart = category.activeSteps.length === 1;\n\t\tif (config.isActiveCategoryClickReset && category.isActive && !isCategoryStart) {\n\t\t\tvoid wizard.resetCategory(category.id);\n\t\t\treturn;\n\t\t}\n\t\tif (!category.isActive && category.isCompleted) {\n\t\t\tvoid wizard.goToCategory(category.id);\n\t\t\treturn;\n\t\t}\n\t\tif (!category.isActive && canAccessCategory(category)) {\n\t\t\tvoid wizard.goToCategory(category.id);\n\t\t}\n\t};\n\n\treturn (\n\t\t<header\n\t\t\tclassName={cn(\n\t\t\t\t'relative mb-8 flex items-center gap-4 border-b border-border bg-background px-4 py-3',\n\t\t\t\tconfig.stickyHeader && 'sticky top-0 z-10'\n\t\t\t)}\n\t\t>\n\t\t\t<WizardBack />\n\t\t\t{showSteps && (\n\t\t\t\t<WizardStepper<Category>\n\t\t\t\t\tcanAccessCategory={canAccessCategory}\n\t\t\t\t\tcategories={tree.activeBranch.shownCategories}\n\t\t\t\t\tdoneDot={config.isDoneDot ? { text: config.doneDotText } : undefined}\n\t\t\t\t\theaderI18n={config.headerI18n}\n\t\t\t\t\tonCategoryClick={onCategoryClick}\n\t\t\t\t\tprogress={wizard.progress}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</header>\n\t);\n}\n","'use client';\n\nimport { type ReactNode } from 'react';\n\nimport { useWizard } from '../use-wizard';\nimport { WizardActionButton } from './wizard-action-button';\n\ninterface IWizardNextComponentProps {\n\tasChild?: boolean;\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\n/**\n * Next button. Calls `wizard.next()` on click. Use `asChild` to compose with a\n * custom button.\n *\n * The default label is contextual:\n * - `nextBtnText` (default \"Next\") within a category\n * - `nextCategoryText` (default \"Continue\") on the last step of a non-final category\n * - `finishText` (default \"Finish\") on the last step of the last category\n */\nexport function WizardNext(props: IWizardNextComponentProps) {\n\tconst wizard = useWizard();\n\t// Skip label compute when caller provides their own children/asChild.\n\tconst defaultLabel = !props.asChild && props.children === undefined ? getNextLabel(wizard) : '';\n\treturn (\n\t\t<WizardActionButton\n\t\t\tasChild={props.asChild}\n\t\t\tclassName={props.className}\n\t\t\tdefaultLabel={defaultLabel}\n\t\t\tonClick={() => void wizard.next()}\n\t\t>\n\t\t\t{props.children}\n\t\t</WizardActionButton>\n\t);\n}\n\nfunction getNextLabel(wizard: ReturnType<typeof useWizard>): string {\n\tconst config = wizard.configOptions;\n\tconst tree = wizard.tree;\n\tconst activeStep = tree.lastActiveStep;\n\tconst category = tree.categoryMap[activeStep.categoryId];\n\tconst isLastStep = category.lastStep.id === activeStep.id;\n\tconst isLastCategory = tree.activeBranch.lastCategory.id === category.id;\n\tif (!isLastStep) return config.nextBtnText;\n\treturn isLastCategory ? config.finishText : config.nextCategoryText;\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\n\nimport { cn } from '~/utils/cn';\nimport { CheckIcon } from 'lucide-react';\n\nimport { type IWizardCategoryView, useWizardCategoriesView } from '../hooks/use-wizard-categories-view';\nimport { useWizard } from '../use-wizard';\n\ninterface IWizardRailProps<Step extends string, Category extends string> {\n\tcanAccessCategory?: (category: IWizardCategoryView<Step, Category>) => boolean;\n\tclassName?: string;\n\theaderI18n?: Partial<Record<Category, ReactNode>>;\n\tsubStepLabels?: Partial<Record<Step, ReactNode>>;\n}\n\n/**\n * Vertical category rail for full-page wizard layouts. Renders one button per\n * shown category with dot state, expands the active category to surface its\n * sub-steps when present, and dispatches `wizard.goToCategory` on click.\n *\n * Pure consumer of `useWizard` — no local state.\n */\nexport function WizardRail<Step extends string, Category extends string, Branch extends string = string>(\n\tprops: IWizardRailProps<Step, Category>\n) {\n\tconst { canAccessCategory, className, headerI18n, subStepLabels } = props;\n\tconst wizard = useWizard<Step, Category, Branch>();\n\tconst view = useWizardCategoriesView<Step, Category, Branch>();\n\tconst labels = headerI18n ?? (wizard.configOptions.headerI18n as Partial<Record<Category, ReactNode>> | undefined);\n\n\tconst isClickable = (category: IWizardCategoryView<Step, Category>) =>\n\t\tcanAccessCategory?.(category) ?? defaultClickable(category.state);\n\n\treturn (\n\t\t<nav aria-label=\"Wizard steps\" className={cn('flex flex-col gap-1', className)}>\n\t\t\t<ol className=\"relative flex flex-col gap-1\">\n\t\t\t\t{view.map((category, idx) => {\n\t\t\t\t\tconst label = labels?.[category.id] ?? String(category.id);\n\t\t\t\t\tconst clickable = isClickable(category);\n\t\t\t\t\tconst isLast = idx === view.length - 1;\n\t\t\t\t\tconst isPassed = category.state === 'completed' || category.state === 'skipped';\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li className=\"relative\" key={category.id}>\n\t\t\t\t\t\t\t{!isLast && (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t'pointer-events-none absolute top-7 -bottom-2 left-5 w-px -translate-x-1/2 transition-colors duration-200',\n\t\t\t\t\t\t\t\t\t\tisPassed ? 'bg-success-border' : 'bg-border'\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\taria-current={category.isActive ? 'step' : undefined}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm font-medium transition-[color,background-color,transform] duration-200 ease-(--ease-out-strong)',\n\t\t\t\t\t\t\t\t\tcategory.state === 'active' && 'bg-success-bg/60 text-success-text',\n\t\t\t\t\t\t\t\t\tcategory.state === 'completed' && 'text-foreground',\n\t\t\t\t\t\t\t\t\tcategory.state === 'skipped' && 'text-muted-foreground opacity-70',\n\t\t\t\t\t\t\t\t\tcategory.state === 'pending' && 'text-muted-foreground',\n\t\t\t\t\t\t\t\t\tclickable\n\t\t\t\t\t\t\t\t\t\t? 'cursor-pointer hover:bg-foreground/[0.06] motion-safe:active:scale-[0.97]'\n\t\t\t\t\t\t\t\t\t\t: 'cursor-default'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tdata-state={category.state}\n\t\t\t\t\t\t\t\tdisabled={!clickable}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\tvoid wizard.goToCategory(category.id);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<RailDot state={category.state} />\n\t\t\t\t\t\t\t\t<span>{label}</span>\n\t\t\t\t\t\t\t</button>\n\n\t\t\t\t\t\t\t{category.isActive && category.subSteps.length > 0 && (\n\t\t\t\t\t\t\t\t<ol className=\"mt-1 ml-7 flex flex-col gap-1 border-l border-border pl-3\">\n\t\t\t\t\t\t\t\t\t{category.subSteps.map(step => (\n\t\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\t\taria-current={step.isActive ? 'step' : undefined}\n\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t'rounded px-2 py-1 text-sm',\n\t\t\t\t\t\t\t\t\t\t\t\tstep.isActive\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'text-success-text font-medium'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'text-muted-foreground'\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\tkey={step.id}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{subStepLabels?.[step.id] ?? String(step.id)}\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</ol>\n\t\t</nav>\n\t);\n}\n\nfunction defaultClickable(state: IWizardCategoryView<string, string>['state']): boolean {\n\treturn state !== 'pending';\n}\n\nfunction RailDot({ state }: { state: IWizardCategoryView<string, string>['state'] }) {\n\treturn (\n\t\t<span\n\t\t\taria-hidden\n\t\t\tclassName={cn(\n\t\t\t\t'flex size-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors',\n\t\t\t\tstate === 'pending' && 'border-border bg-background',\n\t\t\t\tstate === 'active' && 'border-success-border bg-success-bg',\n\t\t\t\tstate === 'completed' && 'border-success-border bg-success-text',\n\t\t\t\tstate === 'skipped' && 'border-border bg-background opacity-60'\n\t\t\t)}\n\t\t>\n\t\t\t{state === 'completed' && (\n\t\t\t\t<CheckIcon className=\"size-2.5 text-background motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-75 motion-safe:duration-200\" />\n\t\t\t)}\n\t\t</span>\n\t);\n}\n","'use client';\n\nimport type { IWizardCategoryState, IWizardStepState } from '../../core/state';\n\nimport { useWizard } from '../use-wizard';\n\nexport interface IWizardCategoryView<Step extends string, Category extends string> {\n\tid: Category;\n\tisActive: boolean;\n\tstate: WizardCategoryViewState;\n\tsubSteps: ReadonlyArray<{ id: Step; isActive: boolean }>;\n}\n\nexport type WizardCategoryViewState = 'active' | 'completed' | 'pending' | 'skipped';\n\nconst EMPTY_SUB_STEPS: ReadonlyArray<{ id: string; isActive: boolean }> = [];\n\n/**\n * Projects the wizard's active branch into a normalized list for navigation\n * surfaces (rail, stepper). Pure projection — re-renders on tree change via\n * `useWizard`.\n */\nexport function useWizardCategoriesView<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n>(): ReadonlyArray<IWizardCategoryView<Step, Category>> {\n\tconst wizard = useWizard<Step, Category, Branch>();\n\treturn wizard.tree.activeBranch.shownCategories.map(category => projectCategory<Step, Category, Branch>(category));\n}\n\nfunction getCategoryState(category: {\n\tisActive: boolean;\n\tisCompleted: boolean;\n\tisSkipped: boolean;\n}): WizardCategoryViewState {\n\tif (category.isActive) return 'active';\n\tif (category.isCompleted) return 'completed';\n\tif (category.isSkipped) return 'skipped';\n\treturn 'pending';\n}\n\nfunction projectCategory<Step extends string, Category extends string, Branch extends string>(\n\tcategory: IWizardCategoryState<Step, Category, Branch>\n): IWizardCategoryView<Step, Category> {\n\tconst shown = category.shownSteps;\n\tconst subSteps =\n\t\tshown.length > 1\n\t\t\t? shown\n\t\t\t\t\t.slice()\n\t\t\t\t\t.sort((a, b) => a.htmlIndex - b.htmlIndex)\n\t\t\t\t\t.map((step: IWizardStepState<Step, Category, Branch>) => ({ id: step.id, isActive: step.isActive }))\n\t\t\t: (EMPTY_SUB_STEPS as ReadonlyArray<{ id: Step; isActive: boolean }>);\n\n\treturn {\n\t\tid: category.id,\n\t\tisActive: category.isActive,\n\t\tstate: getCategoryState(category),\n\t\tsubSteps,\n\t};\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\n\nimport { useCallback, useContext, useSyncExternalStore } from 'react';\n\nimport type { WizardEngine } from '../../core/wizard-engine';\n\nimport { WizardError } from '../../core/errors';\nimport { WizardEngineContext } from '../context';\n\ninterface IWizardStepComponentProps<Step extends string> {\n\tchildren: ReactNode;\n\tid: Step;\n}\n\n/**\n * Renders children only when the active visibility strategy reports the step\n * as visible. Delegates to `WizardEngine.isStepVisible(id)` so swapping the\n * strategy via `withVisibilityStrategy(...)` actually changes mount behavior.\n */\nexport function WizardStep<Step extends string>(props: IWizardStepComponentProps<Step>) {\n\tconst engine = useContext(WizardEngineContext) as null | WizardEngine<Step, string, string>;\n\tif (!engine) {\n\t\tthrow new WizardError('WizardStep must be used inside <WizardProvider>');\n\t}\n\n\tconst getSnapshot = useCallback(() => engine.isStepVisible(props.id), [engine, props.id]);\n\tconst isVisible = useSyncExternalStore(engine.subscribe, getSnapshot, getSnapshot);\n\n\tif (!isVisible) return null;\n\treturn (\n\t\t<div\n\t\t\tclassName=\"motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-1 motion-safe:duration-300 motion-safe:ease-(--ease-out-strong)\"\n\t\t\tid={props.id}\n\t\t>\n\t\t\t{props.children}\n\t\t</div>\n\t);\n}\n","'use client';\n\nimport { type ReactNode, useEffect, useState } from 'react';\n\nimport type { IWizardProviderProps } from '../core/compose-wizard-providers';\nimport type { IWizardStepState } from '../core/state';\n\nimport { WizardEngine, type WizardEngineOptions } from '../core/wizard-engine';\nimport { WizardEngineContext } from './context';\n\ninterface IWizardProviderComponentProps<\n\tStep extends string,\n\tCategory extends string,\n\tBranch extends string = string,\n> extends Partial<IWizardProviderProps<Step, Category, Branch>> {\n\tactiveBranch?: Branch;\n\tchildren: ReactNode;\n\tstate: ReadonlyArray<IWizardStepState<Step, Category, Branch>>;\n}\n\n/**\n * Top-level wizard provider. Captures the boot options once via lazy\n * `useState`, then constructs a fresh `WizardEngine` inside an effect so React\n * 19 Strict Mode's mount/unmount/remount cycle does not leave a permanently\n * disposed engine in shared state. The engine is disposed on unmount.\n *\n * Idiomatic shape:\n * ```tsx\n * <WizardProvider state={...} {...composeWizardProviders(withConfig(...))}>\n * <WizardLayout>...</WizardLayout>\n * </WizardProvider>\n * ```\n */\nexport function WizardProvider<Step extends string, Category extends string, Branch extends string = string>(\n\tprops: IWizardProviderComponentProps<Step, Category, Branch>\n) {\n\tconst { activeBranch, children, config, initializers, listeners, scrollContainer, state, strategies } = props;\n\n\tconst [bootOptions] = useState<WizardEngineOptions<Step, Category, Branch>>(() => ({\n\t\tactiveBranch,\n\t\tconfig,\n\t\tinitializers,\n\t\tlisteners,\n\t\tscrollContainer,\n\t\tstate,\n\t\tstrategies,\n\t}));\n\n\tconst [engine, setEngine] = useState<null | WizardEngine<Step, Category, Branch>>(null);\n\n\tuseEffect(() => {\n\t\tconst newEngine = new WizardEngine<Step, Category, Branch>(bootOptions);\n\n\t\tlet cancelled = false;\n\t\tnewEngine.commitRegistration().then(() => {\n\t\t\tif (!cancelled) setEngine(newEngine);\n\t\t});\n\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t\tnewEngine.dispose();\n\t\t\tsetEngine(prev => (prev === newEngine ? null : prev));\n\t\t};\n\t}, [bootOptions]);\n\n\tif (!engine) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<WizardEngineContext.Provider value={engine as unknown as WizardEngine<string, string, string>}>\n\t\t\t{children}\n\t\t</WizardEngineContext.Provider>\n\t);\n}\n","'use client';\n\nimport { type RefObject, useEffect, useRef } from 'react';\n\nimport type { WizardEngine } from '../core/wizard-engine';\n\nimport { useWizard } from './use-wizard';\n\ninterface IWizardEngineRefCaptureProps<Step extends string, Category extends string> {\n\tengineRef: RefObject<null | WizardEngine<Step, Category>>;\n}\n\n/**\n * Holds a ref to the live `WizardEngine`. Place `<WizardEngineRefCapture\n * engineRef={ref} />` inside `<WizardProvider>` so a form's submit handler\n * (which sits outside the provider) can navigate the wizard programmatically.\n */\nexport function useWizardEngineRef<Step extends string, Category extends string>(): RefObject<null | WizardEngine<\n\tStep,\n\tCategory\n>> {\n\treturn useRef<null | WizardEngine<Step, Category>>(null);\n}\n\nexport function WizardEngineRefCapture<Step extends string, Category extends string>({\n\tengineRef,\n}: IWizardEngineRefCaptureProps<Step, Category>): null {\n\tconst wizard = useWizard<Step, Category>();\n\tuseEffect(() => {\n\t\tengineRef.current = wizard;\n\t\treturn () => {\n\t\t\tengineRef.current = null;\n\t\t};\n\t}, [engineRef, wizard]);\n\treturn null;\n}\n","'use client';\n\nimport { useContext, useEffect, useRef } from 'react';\n\nimport type { WizardEvent } from '../core/events/wizard-events';\nimport type { WizardEngine } from '../core/wizard-engine';\n\nimport { WizardError } from '../core/errors';\nimport { WizardEngineContext } from './context';\n\ntype WildcardOrType<E extends { type: string }> = '*' | E['type'];\n\n/**\n * Subscribe to a wizard event type (or all events with `'*'`). The handler is\n * stored in a ref so updating it across renders doesn't resubscribe — the\n * subscription is bound to the type only.\n */\nexport function useWizardEvent<Step extends string, Category extends string, Branch extends string = string>(\n\ttype: WildcardOrType<WizardEvent<Step, Category, Branch>>,\n\thandler: (event: WizardEvent<Step, Category, Branch>) => void\n): void {\n\tconst engine = useContext(WizardEngineContext) as null | WizardEngine<Step, Category, Branch>;\n\tif (!engine) {\n\t\tthrow new WizardError('useWizardEvent must be used inside <WizardProvider>');\n\t}\n\n\tconst handlerRef = useRef(handler);\n\n\tuseEffect(() => {\n\t\thandlerRef.current = handler;\n\t});\n\n\tuseEffect(() => {\n\t\treturn engine.on(type, event => handlerRef.current(event));\n\t}, [engine, type]);\n}\n","'use client';\n\nimport { useCallback, useContext, useRef, useSyncExternalStore } from 'react';\n\nimport type { IWizardStepState } from '../core/state';\nimport type { WizardEngine } from '../core/wizard-engine';\n\nimport { WizardError } from '../core/errors';\nimport { WizardEngineContext } from './context';\n\n/**\n * Subscribe to a single step's state. Re-renders only when this step's slice\n * changes (compared by `Object.is` on each flag). Returns the step state, or\n * `null` if the engine doesn't know about this id.\n */\nexport function useWizardStep<Step extends string, Category extends string = string, Branch extends string = string>(\n\tstepId: Step\n): IWizardStepState<Step, Category, Branch> | null {\n\tconst engine = useContext(WizardEngineContext) as null | WizardEngine<Step, Category, Branch>;\n\tif (!engine) {\n\t\tthrow new WizardError('useWizardStep must be used inside <WizardProvider>');\n\t}\n\n\tconst lastRef = useRef<IWizardStepState<Step, Category, Branch> | null>(null);\n\n\tconst getSnapshot = useCallback((): IWizardStepState<Step, Category, Branch> | null => {\n\t\tconst tree = engine.getTreeSnapshot();\n\t\tconst next = tree.stepMap[stepId] ?? null;\n\t\tconst prev = lastRef.current;\n\n\t\t// Stable-reference cache so consumers don't re-render unless flags change\n\t\tif (\n\t\t\tprev !== null &&\n\t\t\tnext !== null &&\n\t\t\tprev.isActive === next.isActive &&\n\t\t\tprev.isShow === next.isShow &&\n\t\t\tprev.isCompleted === next.isCompleted &&\n\t\t\tprev.isSkipped === next.isSkipped\n\t\t) {\n\t\t\treturn prev;\n\t\t}\n\n\t\tlastRef.current = next;\n\t\treturn next;\n\t}, [engine, stepId]);\n\n\treturn useSyncExternalStore(engine.subscribe, getSnapshot, getSnapshot);\n}\n"],"mappings":";;;;;;;;;;;;;;AAAO,IAAK,kBAAL,kBAAKA,qBAAL;AACN,EAAAA,iBAAA,cAAW;AACX,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,yBAAsB;AACtB,EAAAA,iBAAA,mBAAgB;AAChB,EAAAA,iBAAA,qBAAkB;AAClB,EAAAA,iBAAA,uBAAoB;AACpB,EAAAA,iBAAA,qBAAkB;AAElB,EAAAA,iBAAA,gBAAa;AACb,EAAAA,iBAAA,kBAAe;AAEf,EAAAA,iBAAA,eAAY;AACZ,EAAAA,iBAAA,iBAAc;AAEd,EAAAA,iBAAA,cAAW;AACX,EAAAA,iBAAA,cAAW;AAhBA,SAAAA;AAAA,GAAA;;;ACAL,IAAM,OAAO,CAAI,QAA4B,IAAI,IAAI,SAAS,CAAC;;;ACA/D,IAAM,UAAU,CAAI,QAAuB,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;;;ACG1E,IAAM,YAAY,CAAC,cAAwD;AACjF,QAAM,aAAa,UAAU,SAAS,KAAK,GAAG;A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AAa,WAAW;AACvE;","names":["WizardEventType","WizardCategoryDirection","jsx","jsx","jsx","jsx","jsxs","jsx","jsxs","jsx","CheckIcon","jsx","jsxs","CheckIcon","jsx","jsx","useEffect","useEffect","useContext","useEffect","useRef","useContext","useRef","useEffect","useCallback","useContext","useRef","useSyncExternalStore","useContext","useRef","useCallback","useSyncExternalStore"]}
|