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/dist/index.cjs CHANGED
@@ -1,110 +1,15 @@
1
- "use client";
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var src_exports = {};
23
- __export(src_exports, {
24
- TypedEmitter: () => TypedEmitter,
25
- WizardActiveProgressStrategy: () => WizardActiveProgressStrategy,
26
- WizardActiveStepRule: () => WizardActiveStepRule,
27
- WizardBack: () => WizardBack,
28
- WizardCategory: () => WizardCategory,
29
- WizardCategoryDirection: () => WizardCategoryDirection,
30
- WizardCompleteEvent: () => WizardCompleteEvent,
31
- WizardCompleteTreeState: () => WizardCompleteTreeState,
32
- WizardComponentsProvider: () => WizardComponentsProvider,
33
- WizardConfig: () => WizardConfig,
34
- WizardDefaultInitializer: () => WizardDefaultInitializer,
35
- WizardDefaultVisibilityStrategy: () => WizardDefaultVisibilityStrategy,
36
- WizardEngine: () => WizardEngine,
37
- WizardEngineContext: () => WizardEngineContext,
38
- WizardEngineRefCapture: () => WizardEngineRefCapture,
39
- WizardError: () => WizardError,
40
- WizardEvent: () => WizardEvent,
41
- WizardEventType: () => WizardEventType,
42
- WizardExitEvent: () => WizardExitEvent,
43
- WizardExitTreeState: () => WizardExitTreeState,
44
- WizardHeader: () => WizardHeader,
45
- WizardInitializationError: () => WizardInitializationError,
46
- WizardInitializer: () => WizardInitializer,
47
- WizardInitializerService: () => WizardInitializerService,
48
- WizardLastActiveVisibilityStrategy: () => WizardLastActiveVisibilityStrategy,
49
- WizardListener: () => WizardListener,
50
- WizardLog: () => WizardLog,
51
- WizardNavigation: () => WizardNavigation,
52
- WizardNavigationCancelledEvent: () => WizardNavigationCancelledEvent,
53
- WizardNavigationEndEvent: () => WizardNavigationEndEvent,
54
- WizardNavigationError: () => WizardNavigationError,
55
- WizardNavigationErrorEvent: () => WizardNavigationErrorEvent,
56
- WizardNavigationIgnoredEvent: () => WizardNavigationIgnoredEvent,
57
- WizardNavigationService: () => WizardNavigationService,
58
- WizardNavigationStartEvent: () => WizardNavigationStartEvent,
59
- WizardNext: () => WizardNext,
60
- WizardPassedPrevCategoriesRule: () => WizardPassedPrevCategoriesRule,
61
- WizardPassedPrevStepsRule: () => WizardPassedPrevStepsRule,
62
- WizardProgressStrategy: () => WizardProgressStrategy,
63
- WizardProvider: () => WizardProvider,
64
- WizardRail: () => WizardRail,
65
- WizardResolveEndEvent: () => WizardResolveEndEvent,
66
- WizardResolveStartEvent: () => WizardResolveStartEvent,
67
- WizardResolverError: () => WizardResolverError,
68
- WizardRule: () => WizardRule,
69
- WizardScrollEndEvent: () => WizardScrollEndEvent,
70
- WizardScrollStartEvent: () => WizardScrollStartEvent,
71
- WizardScrollStrategy: () => WizardScrollStrategy,
72
- WizardShownActiveCategoryRule: () => WizardShownActiveCategoryRule,
73
- WizardSingleActiveCategoryRule: () => WizardSingleActiveCategoryRule,
74
- WizardSmoothScrollStrategy: () => WizardSmoothScrollStrategy,
75
- WizardStateService: () => WizardStateService,
76
- WizardStep: () => WizardStep,
77
- WizardStepHideEvent: () => WizardStepHideEvent,
78
- WizardStepShowEvent: () => WizardStepShowEvent,
79
- WizardStepper: () => WizardStepper,
80
- WizardStepperDot: () => WizardStepperDot,
81
- WizardStore: () => WizardStore,
82
- WizardTreeStateBuilder: () => WizardTreeStateBuilder,
83
- WizardVisibilityStrategy: () => WizardVisibilityStrategy,
84
- buildWizardBranchState: () => buildWizardBranchState,
85
- buildWizardCategoryState: () => buildWizardCategoryState,
86
- buildWizardTreeState: () => buildWizardTreeState,
87
- composeWizardProviders: () => composeWizardProviders,
88
- scrollToStep: () => scrollToStep,
89
- useWizard: () => useWizard,
90
- useWizardCategoriesView: () => useWizardCategoriesView,
91
- useWizardComponents: () => useWizardComponents,
92
- useWizardEngineRef: () => useWizardEngineRef,
93
- useWizardEvent: () => useWizardEvent,
94
- useWizardStep: () => useWizardStep,
95
- withConfig: () => withConfig,
96
- withInitializer: () => withInitializer,
97
- withListener: () => withListener,
98
- withProgressStrategy: () => withProgressStrategy,
99
- withScrollContainer: () => withScrollContainer,
100
- withScrollStrategy: () => withScrollStrategy,
101
- withVisibilityStrategy: () => withVisibilityStrategy,
102
- wizardDefaultBranch: () => wizardDefaultBranch,
103
- wizardDefaultConfig: () => wizardDefaultConfig,
104
- wizardDefaultState: () => wizardDefaultState,
105
- wizardRules: () => wizardRules
106
- });
107
- module.exports = __toCommonJS(src_exports);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21;"use client";
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ var _chunkXNH2LQZLcjs = require('./chunk-XNH2LQZL.cjs');
108
13
 
109
14
  // src/enums/wizard-event-type.enum.ts
110
15
  var WizardEventType = /* @__PURE__ */ ((WizardEventType2) => {
@@ -165,13 +70,13 @@ function buildWizardBranchState(id, categories) {
165
70
  if (category.isSkipped) skippedCategories.push(category);
166
71
  if (category.isPassed) passedCategories.push(category);
167
72
  }
168
- const activeCategory = activeCategories[0] ?? shownCategories[0];
73
+ const activeCategory = _nullishCoalesce(activeCategories[0], () => ( shownCategories[0]));
169
74
  const getShownCategoryIndex = (category) => shownCategories.indexOf(category);
170
75
  const activeCategoryIndex = getShownCategoryIndex(activeCategory);
171
76
  const firstCategory = shownCategories[0];
172
77
  const lastCategory = last(shownCategories);
173
- const prevCategory = activeCategoryIndex > 0 ? shownCategories[activeCategoryIndex - 1] ?? null : null;
174
- const nextCategory = activeCategoryIndex >= 0 ? shownCategories[activeCategoryIndex + 1] ?? null : null;
78
+ const prevCategory = activeCategoryIndex > 0 ? _nullishCoalesce(shownCategories[activeCategoryIndex - 1], () => ( null)) : null;
79
+ const nextCategory = activeCategoryIndex >= 0 ? _nullishCoalesce(shownCategories[activeCategoryIndex + 1], () => ( null)) : null;
175
80
  const getShownCategories = (fromIndex, toIndex) => shownCategories.slice(fromIndex, toIndex + 1);
176
81
  return {
177
82
  activeCategories,
@@ -192,7 +97,7 @@ function buildWizardBranchState(id, categories) {
192
97
  };
193
98
  }
194
99
  function buildWizardCategoryState(id, htmlIndex, steps) {
195
- const branches = steps[0]?.branches ?? [];
100
+ const branches = _nullishCoalesce(_optionalChain([steps, 'access', _2 => _2[0], 'optionalAccess', _3 => _3.branches]), () => ( []));
196
101
  const shownSteps = [];
197
102
  const activeSteps = [];
198
103
  const completedSteps = [];
@@ -217,8 +122,8 @@ function buildWizardCategoryState(id, htmlIndex, steps) {
217
122
  const firstStep = shownSteps[0];
218
123
  const lastStep = last(shownSteps);
219
124
  const firstActiveStep = activeSteps[0];
220
- const prevStep = activeStepIndex > 0 ? shownSteps[activeStepIndex - 1] ?? null : null;
221
- const nextStep = activeStepIndex >= 0 ? shownSteps[activeStepIndex + 1] ?? null : null;
125
+ const prevStep = activeStepIndex > 0 ? _nullishCoalesce(shownSteps[activeStepIndex - 1], () => ( null)) : null;
126
+ const nextStep = activeStepIndex >= 0 ? _nullishCoalesce(shownSteps[activeStepIndex + 1], () => ( null)) : null;
222
127
  return {
223
128
  activeStepIndex,
224
129
  activeSteps,
@@ -304,7 +209,7 @@ function pickActiveBranch(branches, branchMap, activeBranchId) {
304
209
  if (activeBranchId && branchMap[activeBranchId]) {
305
210
  return branchMap[activeBranchId];
306
211
  }
307
- return activeBranches[0] ?? branches[0];
212
+ return _nullishCoalesce(activeBranches[0], () => ( branches[0]));
308
213
  }
309
214
 
310
215
  // src/core/builders/wizard-default.const.ts
@@ -316,24 +221,6 @@ var wizardDefaultState = {
316
221
  };
317
222
  var wizardDefaultBranch = "main";
318
223
 
319
- // src/core/errors/wizard.error.ts
320
- var WizardError = class extends Error {
321
- name = "WizardError";
322
- constructor(message) {
323
- super(message);
324
- Object.setPrototypeOf(this, new.target.prototype);
325
- }
326
- };
327
- var WizardInitializationError = class extends WizardError {
328
- name = "WizardInitializationError";
329
- };
330
- var WizardNavigationError = class extends WizardError {
331
- name = "WizardNavigationError";
332
- };
333
- var WizardResolverError = class extends WizardError {
334
- name = "WizardResolverError";
335
- };
336
-
337
224
  // src/core/rules/wizard-rule.ts
338
225
  var WizardRule = class {
339
226
  };
@@ -342,7 +229,7 @@ var WizardRule = class {
342
229
  var WizardActiveStepRule = class extends WizardRule {
343
230
  verify({ lastActiveStep }) {
344
231
  if (!lastActiveStep) {
345
- throw new WizardError("[WizardActiveStepRule]: There are no available active step in tree state.");
232
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)("[WizardActiveStepRule]: There are no available active step in tree state.");
346
233
  }
347
234
  }
348
235
  };
@@ -354,7 +241,7 @@ var WizardPassedPrevCategoriesRule = class extends WizardRule {
354
241
  const hasUnpassedPrevCategories = prevCategories.some((prevCategory) => !prevCategory.isPassed);
355
242
  if (hasUnpassedPrevCategories) {
356
243
  const prevCategoryNames = prevCategories.map((prevCategory) => prevCategory.id).join(",");
357
- throw new WizardError(
244
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)(
358
245
  `[WizardPassedPrevCategoriesRule]: Active category "${activeCategory.id}" has neither completed nor skipped prev categories. Please, skip or complete categories: "${prevCategoryNames}".`
359
246
  );
360
247
  }
@@ -368,7 +255,7 @@ var WizardPassedPrevStepsRule = class extends WizardRule {
368
255
  const prevUnpassedSteps = prevSteps.filter((prevStep) => !prevStep.isCompleted && !prevStep.isSkipped);
369
256
  if (prevUnpassedSteps.length) {
370
257
  const prevStepNames = prevUnpassedSteps.map((prevStep) => prevStep.id).join(",");
371
- throw new WizardError(
258
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)(
372
259
  `[WizardPassedPrevStepsRule]: Last active step "${activeCategory.lastActiveStep.id}" has not completed steps before. Please, complete or hide steps: "${prevStepNames}".`
373
260
  );
374
261
  }
@@ -379,7 +266,7 @@ var WizardPassedPrevStepsRule = class extends WizardRule {
379
266
  var WizardShownActiveCategoryRule = class extends WizardRule {
380
267
  verify({ activeCategory }) {
381
268
  if (!activeCategory.isShow) {
382
- throw new WizardError(
269
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)(
383
270
  `[WizardShownActiveCategoryRule]: Active category is hidden. Please, show category "${activeCategory.id}" to be able to activate it.`
384
271
  );
385
272
  }
@@ -391,7 +278,7 @@ var WizardSingleActiveCategoryRule = class extends WizardRule {
391
278
  verify({ activeBranch }) {
392
279
  if (activeBranch.activeCategories.length > 1) {
393
280
  const activeCategoryNames = activeBranch.activeCategories.map((c) => c.id).join(",");
394
- throw new WizardError(
281
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)(
395
282
  `[WizardSingleActiveCategoryRule]: There are 2 active categories at the same time: ${activeCategoryNames}.`
396
283
  );
397
284
  }
@@ -408,31 +295,31 @@ var wizardRules = [
408
295
  ];
409
296
 
410
297
  // src/core/state/wizard-tree.state.ts
411
- var WizardCompleteTreeState = class {
412
- constructor(originTree) {
298
+ var WizardCompleteTreeState = (_class = class {
299
+ constructor(originTree) {;_class.prototype.__init.call(this);
413
300
  this.originTree = originTree;
414
301
  }
415
- originTree;
416
- state = "complete";
417
- };
418
- var WizardExitTreeState = class {
419
- constructor(originTree) {
302
+
303
+ __init() {this.state = "complete"}
304
+ }, _class);
305
+ var WizardExitTreeState = (_class2 = class {
306
+ constructor(originTree) {;_class2.prototype.__init2.call(this);
420
307
  this.originTree = originTree;
421
308
  }
422
- originTree;
423
- state = "exit";
424
- };
309
+
310
+ __init2() {this.state = "exit"}
311
+ }, _class2);
425
312
 
426
313
  // src/core/state/project-to-tree.ts
427
314
  var projectToTree = (target) => target instanceof WizardExitTreeState || target instanceof WizardCompleteTreeState ? target.originTree : target;
428
315
 
429
316
  // src/core/builders/wizard-tree-state.builder.ts
430
317
  var WizardTreeStateBuilder = class _WizardTreeStateBuilder {
431
- branch;
432
- state;
318
+
319
+
433
320
  constructor(treeState, branch) {
434
321
  this.state = treeState.state.map((step) => ({ ...step }));
435
- this.branch = branch ?? treeState.activeBranch.id;
322
+ this.branch = _nullishCoalesce(branch, () => ( treeState.activeBranch.id));
436
323
  }
437
324
  static validate(tree) {
438
325
  wizardRules.forEach((rule) => rule.verify(tree));
@@ -444,7 +331,7 @@ var WizardTreeStateBuilder = class _WizardTreeStateBuilder {
444
331
  for (let i = 0; i < shown.length; i++) {
445
332
  const step = shown[i];
446
333
  const prev = shown[i - 1];
447
- step.isActive = step.isCompleted || (prev?.isCompleted ?? true);
334
+ step.isActive = step.isCompleted || (_nullishCoalesce(_optionalChain([prev, 'optionalAccess', _4 => _4.isCompleted]), () => ( true)));
448
335
  }
449
336
  return this;
450
337
  }
@@ -605,111 +492,111 @@ var WizardEvent = class {
605
492
  constructor(navigation) {
606
493
  this.navigation = navigation;
607
494
  }
608
- navigation;
495
+
609
496
  };
610
- var WizardCompleteEvent = class extends WizardEvent {
497
+ var WizardCompleteEvent = (_class3 = class extends WizardEvent {
611
498
  constructor(navigation) {
612
- super(navigation);
499
+ super(navigation);_class3.prototype.__init3.call(this);;
613
500
  this.navigation = navigation;
614
501
  }
615
- navigation;
616
- type = "complete" /* Complete */;
617
- };
618
- var WizardExitEvent = class extends WizardEvent {
619
- type = "exit" /* Exit */;
620
- };
621
- var WizardNavigationCancelledEvent = class extends WizardEvent {
502
+
503
+ __init3() {this.type = "complete"} /* Complete */
504
+ }, _class3);
505
+ var WizardExitEvent = (_class4 = class extends WizardEvent {constructor(...args2) { super(...args2); _class4.prototype.__init4.call(this); }
506
+ __init4() {this.type = "exit"} /* Exit */
507
+ }, _class4);
508
+ var WizardNavigationCancelledEvent = (_class5 = class extends WizardEvent {
622
509
  constructor(navigation, reason) {
623
- super(navigation);
510
+ super(navigation);_class5.prototype.__init5.call(this);;
624
511
  this.navigation = navigation;
625
512
  this.reason = reason;
626
513
  }
627
- navigation;
628
- reason;
629
- type = "navigation_cancelled" /* NavigationCancelled */;
630
- };
631
- var WizardNavigationEndEvent = class extends WizardEvent {
514
+
515
+
516
+ __init5() {this.type = "navigation_cancelled"} /* NavigationCancelled */
517
+ }, _class5);
518
+ var WizardNavigationEndEvent = (_class6 = class extends WizardEvent {
632
519
  constructor(navigation) {
633
- super(navigation);
520
+ super(navigation);_class6.prototype.__init6.call(this);;
634
521
  this.navigation = navigation;
635
522
  }
636
- navigation;
637
- type = "navigation_end" /* NavigationEnd */;
638
- };
639
- var WizardNavigationErrorEvent = class extends WizardEvent {
523
+
524
+ __init6() {this.type = "navigation_end"} /* NavigationEnd */
525
+ }, _class6);
526
+ var WizardNavigationErrorEvent = (_class7 = class extends WizardEvent {
640
527
  constructor(navigation) {
641
- super(navigation);
528
+ super(navigation);_class7.prototype.__init7.call(this);;
642
529
  this.navigation = navigation;
643
530
  }
644
- navigation;
645
- type = "navigation_error" /* NavigationError */;
646
- };
647
- var WizardNavigationIgnoredEvent = class extends WizardEvent {
531
+
532
+ __init7() {this.type = "navigation_error"} /* NavigationError */
533
+ }, _class7);
534
+ var WizardNavigationIgnoredEvent = (_class8 = class extends WizardEvent {
648
535
  constructor(navigation, reason) {
649
- super(navigation);
536
+ super(navigation);_class8.prototype.__init8.call(this);;
650
537
  this.navigation = navigation;
651
538
  this.reason = reason;
652
539
  }
653
- navigation;
654
- reason;
655
- type = "navigation_ignored" /* NavigationIgnored */;
656
- };
657
- var WizardNavigationStartEvent = class extends WizardEvent {
540
+
541
+
542
+ __init8() {this.type = "navigation_ignored"} /* NavigationIgnored */
543
+ }, _class8);
544
+ var WizardNavigationStartEvent = (_class9 = class extends WizardEvent {
658
545
  constructor(navigation) {
659
- super(navigation);
546
+ super(navigation);_class9.prototype.__init9.call(this);;
660
547
  this.navigation = navigation;
661
548
  }
662
- navigation;
663
- type = "navigation_start" /* NavigationStart */;
664
- };
665
- var WizardResolveEndEvent = class extends WizardEvent {
549
+
550
+ __init9() {this.type = "navigation_start"} /* NavigationStart */
551
+ }, _class9);
552
+ var WizardResolveEndEvent = (_class10 = class extends WizardEvent {
666
553
  constructor(navigation) {
667
- super(navigation);
554
+ super(navigation);_class10.prototype.__init10.call(this);;
668
555
  this.navigation = navigation;
669
556
  }
670
- navigation;
671
- type = "resolve_end" /* ResolveEnd */;
672
- };
673
- var WizardResolveStartEvent = class extends WizardEvent {
557
+
558
+ __init10() {this.type = "resolve_end"} /* ResolveEnd */
559
+ }, _class10);
560
+ var WizardResolveStartEvent = (_class11 = class extends WizardEvent {
674
561
  constructor(navigation) {
675
- super(navigation);
562
+ super(navigation);_class11.prototype.__init11.call(this);;
676
563
  this.navigation = navigation;
677
564
  }
678
- navigation;
679
- type = "resolve_start" /* ResolveStart */;
680
- };
681
- var WizardScrollEndEvent = class extends WizardEvent {
565
+
566
+ __init11() {this.type = "resolve_start"} /* ResolveStart */
567
+ }, _class11);
568
+ var WizardScrollEndEvent = (_class12 = class extends WizardEvent {
682
569
  constructor(navigation) {
683
- super(navigation);
570
+ super(navigation);_class12.prototype.__init12.call(this);;
684
571
  this.navigation = navigation;
685
572
  }
686
- navigation;
687
- type = "scroll_end" /* ScrollEnd */;
688
- };
689
- var WizardScrollStartEvent = class extends WizardEvent {
573
+
574
+ __init12() {this.type = "scroll_end"} /* ScrollEnd */
575
+ }, _class12);
576
+ var WizardScrollStartEvent = (_class13 = class extends WizardEvent {
690
577
  constructor(navigation) {
691
- super(navigation);
578
+ super(navigation);_class13.prototype.__init13.call(this);;
692
579
  this.navigation = navigation;
693
580
  }
694
- navigation;
695
- type = "scroll_start" /* ScrollStart */;
696
- };
697
- var WizardStepHideEvent = class extends WizardEvent {
581
+
582
+ __init13() {this.type = "scroll_start"} /* ScrollStart */
583
+ }, _class13);
584
+ var WizardStepHideEvent = (_class14 = class extends WizardEvent {
698
585
  constructor(navigation) {
699
- super(navigation);
586
+ super(navigation);_class14.prototype.__init14.call(this);;
700
587
  this.navigation = navigation;
701
588
  }
702
- navigation;
703
- type = "step_hide" /* StepHide */;
704
- };
705
- var WizardStepShowEvent = class extends WizardEvent {
589
+
590
+ __init14() {this.type = "step_hide"} /* StepHide */
591
+ }, _class14);
592
+ var WizardStepShowEvent = (_class15 = class extends WizardEvent {
706
593
  constructor(navigation) {
707
- super(navigation);
594
+ super(navigation);_class15.prototype.__init15.call(this);;
708
595
  this.navigation = navigation;
709
596
  }
710
- navigation;
711
- type = "step_show" /* StepShow */;
712
- };
597
+
598
+ __init15() {this.type = "step_show"} /* StepShow */
599
+ }, _class15);
713
600
 
714
601
  // src/core/initializers/wizard-initializer.ts
715
602
  var WizardInitializer = class {
@@ -722,7 +609,7 @@ var WizardDefaultInitializer = class extends WizardInitializer {
722
609
  if (tree.activeSteps.length > 0) {
723
610
  return builder.build();
724
611
  }
725
- const firstUnpassed = tree.activeBranch.shownCategories.find((category) => !category.isPassed) ?? tree.activeCategory;
612
+ const firstUnpassed = _nullishCoalesce(tree.activeBranch.shownCategories.find((category) => !category.isPassed), () => ( tree.activeCategory));
726
613
  return builder.activateCategory(firstUnpassed.id).build();
727
614
  }
728
615
  };
@@ -749,8 +636,8 @@ var WizardInitializerService = class {
749
636
  this.wizardLog = wizardLog;
750
637
  this.wizardInitializers = wizardInitializers;
751
638
  }
752
- wizardLog;
753
- wizardInitializers;
639
+
640
+
754
641
  async getInitialState(state, activeBranch) {
755
642
  const htmlTree = buildWizardTreeState(state, activeBranch);
756
643
  this.wizardLog.trace("HTML tree", htmlTree);
@@ -772,7 +659,7 @@ var WizardInitializerService = class {
772
659
  if (!activeBranch) return;
773
660
  if (!htmlTree.branchMap[activeBranch]) {
774
661
  const branchIds = htmlTree.branches.map((branch) => branch.id).join(",");
775
- throw new WizardError(
662
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)(
776
663
  `[WizardInitializerService02]: There is no branch with id "${activeBranch}". List of available branches: ${branchIds}.`
777
664
  );
778
665
  }
@@ -785,7 +672,7 @@ var WizardInitializerService = class {
785
672
  else seen.add(s.id);
786
673
  }
787
674
  if (duplicates.length > 0) {
788
- throw new WizardInitializationError(
675
+ throw new (0, _chunkXNH2LQZLcjs.WizardInitializationError)(
789
676
  `[WizardInitializerService01]: There are steps with the same ID: ${duplicates.join(",")}.`
790
677
  );
791
678
  }
@@ -793,8 +680,8 @@ var WizardInitializerService = class {
793
680
  };
794
681
 
795
682
  // src/core/navigation/typed-emitter.ts
796
- var TypedEmitter = class {
797
- map = /* @__PURE__ */ new Map();
683
+ var TypedEmitter = (_class16 = class {constructor() { _class16.prototype.__init16.call(this); }
684
+ __init16() {this.map = /* @__PURE__ */ new Map()}
798
685
  dispose() {
799
686
  this.map.clear();
800
687
  }
@@ -819,7 +706,7 @@ var TypedEmitter = class {
819
706
  set.delete(handler);
820
707
  };
821
708
  }
822
- };
709
+ }, _class16);
823
710
 
824
711
  // src/core/navigation/wizard-navigation.ts
825
712
  var WizardNavigation = class _WizardNavigation {
@@ -835,15 +722,15 @@ var WizardNavigation = class _WizardNavigation {
835
722
  this.isExit = to instanceof WizardExitTreeState;
836
723
  this.isComplete = to instanceof WizardCompleteTreeState;
837
724
  }
838
- from;
839
- to;
840
- direction;
841
- id;
842
- isCategoryChanging;
843
- isComplete;
844
- isExit;
845
- isScrollChanging;
846
- isSkipping;
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
847
734
  static getDirection(from, to) {
848
735
  if (_WizardNavigation.isCategoryChanging(from, to)) {
849
736
  return from.activeCategory.htmlIndex > to.activeCategory.htmlIndex ? "back" : "next";
@@ -876,24 +763,24 @@ var WizardNavigation = class _WizardNavigation {
876
763
  };
877
764
 
878
765
  // src/core/navigation/navigation-service.ts
879
- var WizardNavigationService = class {
880
- constructor(wizardStore, wizardConfig, wizardStateService, wizardScrollStrategy) {
766
+ var WizardNavigationService = (_class17 = class {
767
+ constructor(wizardStore, wizardConfig, wizardStateService, wizardScrollStrategy) {;_class17.prototype.__init17.call(this);_class17.prototype.__init18.call(this);_class17.prototype.__init19.call(this);_class17.prototype.__init20.call(this);
881
768
  this.wizardStore = wizardStore;
882
769
  this.wizardConfig = wizardConfig;
883
770
  this.wizardStateService = wizardStateService;
884
771
  this.wizardScrollStrategy = wizardScrollStrategy;
885
772
  }
886
- wizardStore;
887
- wizardConfig;
888
- wizardStateService;
889
- wizardScrollStrategy;
773
+
774
+
775
+
776
+
890
777
  get isNavigating() {
891
778
  return !!this.inFlight;
892
779
  }
893
- disposed = false;
894
- emitter = new TypedEmitter();
895
- inFlight = null;
896
- prevSuccessId = null;
780
+ __init17() {this.disposed = false}
781
+ __init18() {this.emitter = new TypedEmitter()}
782
+ __init19() {this.inFlight = null}
783
+ __init20() {this.prevSuccessId = null}
897
784
  async completeWizard() {
898
785
  const tree = this.wizardStore.getTreeSnapshot();
899
786
  const to = new WizardCompleteTreeState(tree);
@@ -912,7 +799,7 @@ var WizardNavigationService = class {
912
799
  const tree = this.wizardStore.getTreeSnapshot();
913
800
  const to = new WizardExitTreeState(tree);
914
801
  return this.navigate(to);
915
- } catch {
802
+ } catch (e2) {
916
803
  this.emitter.emit(new WizardExitEvent());
917
804
  return true;
918
805
  }
@@ -954,7 +841,7 @@ var WizardNavigationService = class {
954
841
  if (this.isAbortReason(e, abort.signal)) {
955
842
  return false;
956
843
  }
957
- if (e instanceof WizardResolverError) {
844
+ if (e instanceof _chunkXNH2LQZLcjs.WizardResolverError) {
958
845
  this.emitter.emit(new WizardNavigationCancelledEvent(navigation, "resolver"));
959
846
  return false;
960
847
  }
@@ -1044,7 +931,7 @@ var WizardNavigationService = class {
1044
931
  const result = await Promise.race([Promise.resolve(resolver(navigation)), abortPromise]);
1045
932
  if (signal.aborted) throw new DOMException("aborted", "AbortError");
1046
933
  if (!result) {
1047
- throw new WizardResolverError(`Resolver rejected navigation ${navigation.id}`);
934
+ throw new (0, _chunkXNH2LQZLcjs.WizardResolverError)(`Resolver rejected navigation ${navigation.id}`);
1048
935
  }
1049
936
  }
1050
937
  isAbortReason(error, signal) {
@@ -1082,7 +969,7 @@ var WizardNavigationService = class {
1082
969
  }
1083
970
  return true;
1084
971
  }
1085
- };
972
+ }, _class17);
1086
973
 
1087
974
  // src/core/navigation/state-service.ts
1088
975
  var WizardStateService = class {
@@ -1090,8 +977,8 @@ var WizardStateService = class {
1090
977
  this.wizardStore = wizardStore;
1091
978
  this.wizardConfig = wizardConfig;
1092
979
  }
1093
- wizardStore;
1094
- wizardConfig;
980
+
981
+
1095
982
  completeCategory(category, tree = this.currentTree()) {
1096
983
  const { activeBranch } = tree;
1097
984
  const { activeCategory, nextCategory } = activeBranch;
@@ -1114,7 +1001,7 @@ var WizardStateService = class {
1114
1001
  const toCategoryIndex = toCategoryBranch.getShownCategoryIndex(toCategory);
1115
1002
  const activeCategoryIndex = toCategoryBranch.getShownCategoryIndex(activeCategory);
1116
1003
  if (activeBranch !== toCategoryBranch && toCategoryIndex > activeCategoryIndex) {
1117
- throw new WizardError(
1004
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)(
1118
1005
  `[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.`
1119
1006
  );
1120
1007
  }
@@ -1145,13 +1032,13 @@ var WizardStateService = class {
1145
1032
  next(branch, tree = this.currentTree()) {
1146
1033
  const { activeBranch, branchMap } = tree;
1147
1034
  const nextBranch = branch ? branchMap[branch] : activeBranch;
1148
- const builder = new WizardTreeStateBuilder(tree, branch ?? activeBranch.id);
1035
+ const builder = new WizardTreeStateBuilder(tree, _nullishCoalesce(branch, () => ( activeBranch.id)));
1149
1036
  const activeCategory = nextBranch.activeCategory;
1150
1037
  const activeStep = activeCategory.lastActiveStep;
1151
1038
  const nextCategory = nextBranch.nextCategory;
1152
1039
  const nextStep = activeCategory.nextStep;
1153
1040
  if (activeBranch.activeCategory !== nextBranch.activeCategory) {
1154
- throw new WizardError(
1041
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)(
1155
1042
  `[State01]: In order to move to the "${branch}" branch, you need to have common category between 2 branches`
1156
1043
  );
1157
1044
  }
@@ -1171,12 +1058,12 @@ var WizardStateService = class {
1171
1058
  nextCategory(branch, tree = this.currentTree()) {
1172
1059
  const { activeBranch, branchMap } = tree;
1173
1060
  const nextBranch = branch ? branchMap[branch] : activeBranch;
1174
- const builder = new WizardTreeStateBuilder(tree, branch ?? activeBranch.id);
1061
+ const builder = new WizardTreeStateBuilder(tree, _nullishCoalesce(branch, () => ( activeBranch.id)));
1175
1062
  const activeCategory = nextBranch.activeCategory;
1176
1063
  const activeStep = activeCategory.lastActiveStep;
1177
1064
  const nextCategory = nextBranch.nextCategory;
1178
1065
  if (activeBranch.activeCategory !== nextBranch.activeCategory) {
1179
- throw new WizardError(
1066
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)(
1180
1067
  `[State01]: In order to move to the "${branch}" branch, you need to have common category between 2 branches`
1181
1068
  );
1182
1069
  }
@@ -1308,16 +1195,16 @@ var WizardActiveProgressStrategy = class extends WizardProgressStrategy {
1308
1195
  };
1309
1196
 
1310
1197
  // src/core/strategies/scroll/wizard-scroll.strategy.ts
1311
- var WizardScrollStrategy = class {
1198
+ var WizardScrollStrategy = (_class18 = class {
1312
1199
  // Thin re-export so subclasses keep the existing call site.
1313
- static projectToTree = projectToTree;
1314
- container;
1200
+ static __initStatic() {this.projectToTree = projectToTree}
1201
+
1315
1202
  /** Called when toggling step/category visibility (instant scroll by default). */
1316
1203
  onToggle(navigation) {
1317
1204
  const tree = projectToTree(navigation.to);
1318
1205
  if (!tree) return Promise.resolve(false);
1319
- const isFirstStepOfCategory = tree.lastActiveStep?.id === tree.activeCategory.firstStep?.id;
1320
- return scrollToStep(isFirstStepOfCategory ? null : tree.lastActiveStep?.id, "auto", this.container);
1206
+ const isFirstStepOfCategory = _optionalChain([tree, 'access', _5 => _5.lastActiveStep, 'optionalAccess', _6 => _6.id]) === _optionalChain([tree, 'access', _7 => _7.activeCategory, 'access', _8 => _8.firstStep, 'optionalAccess', _9 => _9.id]);
1207
+ return scrollToStep(isFirstStepOfCategory ? null : _optionalChain([tree, 'access', _10 => _10.lastActiveStep, 'optionalAccess', _11 => _11.id]), "auto", this.container);
1321
1208
  }
1322
1209
  /**
1323
1210
  * Imperative scroll-to-top of the configured container (or window). Useful
@@ -1330,7 +1217,7 @@ var WizardScrollStrategy = class {
1330
1217
  setContainer(container) {
1331
1218
  this.container = container;
1332
1219
  }
1333
- };
1220
+ }, _class18.__initStatic(), _class18);
1334
1221
  function scrollToStep(stepId, behavior, container) {
1335
1222
  if (typeof document === "undefined") return Promise.resolve(false);
1336
1223
  const reducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : false;
@@ -1362,13 +1249,13 @@ var WizardSmoothScrollStrategy = class extends WizardScrollStrategy {
1362
1249
  super();
1363
1250
  this.wizardConfig = wizardConfig;
1364
1251
  }
1365
- wizardConfig;
1252
+
1366
1253
  onNavigate(navigation) {
1367
1254
  const tree = WizardScrollStrategy.projectToTree(navigation.to);
1368
1255
  if (!tree) return Promise.resolve(false);
1369
- const isFirstStepOfCategory = tree.lastActiveStep?.id === tree.activeCategory.firstStep?.id;
1370
- const stepId = isFirstStepOfCategory ? null : tree.lastActiveStep?.id;
1371
- const useInstant = navigation.isCategoryChanging || (this.wizardConfig?.isMobile ?? false);
1256
+ const isFirstStepOfCategory = _optionalChain([tree, 'access', _12 => _12.lastActiveStep, 'optionalAccess', _13 => _13.id]) === _optionalChain([tree, 'access', _14 => _14.activeCategory, 'access', _15 => _15.firstStep, 'optionalAccess', _16 => _16.id]);
1257
+ const stepId = isFirstStepOfCategory ? null : _optionalChain([tree, 'access', _17 => _17.lastActiveStep, 'optionalAccess', _18 => _18.id]);
1258
+ const useInstant = navigation.isCategoryChanging || (_nullishCoalesce(_optionalChain([this, 'access', _19 => _19.wizardConfig, 'optionalAccess', _20 => _20.isMobile]), () => ( false)));
1372
1259
  return scrollToStep(stepId, useInstant ? "auto" : "smooth", this.container);
1373
1260
  }
1374
1261
  };
@@ -1383,10 +1270,10 @@ var WizardDefaultVisibilityStrategy = class extends WizardVisibilityStrategy {
1383
1270
  super();
1384
1271
  this.wizardConfig = wizardConfig;
1385
1272
  }
1386
- wizardConfig;
1273
+
1387
1274
  isStepVisible(step, tree) {
1388
1275
  const isShowStep = step.isActive && step.isShow;
1389
- const isLastActiveStep = step.id === tree.lastActiveStep?.id;
1276
+ const isLastActiveStep = step.id === _optionalChain([tree, 'access', _21 => _21.lastActiveStep, 'optionalAccess', _22 => _22.id]);
1390
1277
  return this.wizardConfig.isMobile ? isShowStep && isLastActiveStep : isShowStep;
1391
1278
  }
1392
1279
  };
@@ -1395,7 +1282,7 @@ var WizardDefaultVisibilityStrategy = class extends WizardVisibilityStrategy {
1395
1282
  var WizardLastActiveVisibilityStrategy = class extends WizardVisibilityStrategy {
1396
1283
  isStepVisible(step, tree) {
1397
1284
  const isShowStep = step.isActive && step.isShow;
1398
- const isLastActiveStep = step.id === tree.lastActiveStep?.id;
1285
+ const isLastActiveStep = step.id === _optionalChain([tree, 'access', _23 => _23.lastActiveStep, 'optionalAccess', _24 => _24.id]);
1399
1286
  return isShowStep && isLastActiveStep;
1400
1287
  }
1401
1288
  };
@@ -1427,21 +1314,21 @@ var wizardDefaultConfig = {
1427
1314
  };
1428
1315
 
1429
1316
  // src/core/wizard-config.ts
1430
- var WizardConfig = class {
1317
+ var WizardConfig = (_class19 = class {
1431
1318
  /**
1432
1319
  * Whether the wizard is rendering on a mobile viewport. Used by the default
1433
1320
  * visibility and scroll strategies. The React adapter (Phase 15) updates this
1434
1321
  * via a media-query subscription; in plain Node (tests/SSR), it stays `false`.
1435
1322
  */
1436
- isMobile = false;
1323
+ __init21() {this.isMobile = false}
1437
1324
  get options() {
1438
1325
  return this.current;
1439
1326
  }
1440
- current;
1441
- disposed = false;
1442
- listeners = /* @__PURE__ */ new Set();
1443
- notifyScheduled = false;
1444
- constructor(overrides = {}) {
1327
+
1328
+ __init22() {this.disposed = false}
1329
+ __init23() {this.listeners = /* @__PURE__ */ new Set()}
1330
+ __init24() {this.notifyScheduled = false}
1331
+ constructor(overrides = {}) {;_class19.prototype.__init21.call(this);_class19.prototype.__init22.call(this);_class19.prototype.__init23.call(this);_class19.prototype.__init24.call(this);
1445
1332
  this.current = { ...wizardDefaultConfig, ...overrides };
1446
1333
  }
1447
1334
  dispose() {
@@ -1485,16 +1372,16 @@ var WizardConfig = class {
1485
1372
  }
1486
1373
  });
1487
1374
  }
1488
- };
1375
+ }, _class19);
1489
1376
 
1490
1377
  // src/core/wizard-log.ts
1491
1378
  var WizardLog = class {
1492
1379
  constructor(wizardConfig) {
1493
1380
  this.wizardConfig = wizardConfig;
1494
1381
  }
1495
- wizardConfig;
1382
+
1496
1383
  error(e) {
1497
- if (!(e instanceof WizardError)) {
1384
+ if (!(e instanceof _chunkXNH2LQZLcjs.WizardError)) {
1498
1385
  console.error(e);
1499
1386
  return;
1500
1387
  }
@@ -1511,31 +1398,31 @@ var WizardLog = class {
1511
1398
  };
1512
1399
 
1513
1400
  // src/core/wizard-store.ts
1514
- var WizardStore = class {
1515
- constructor(storagePrefix) {
1401
+ var WizardStore = (_class20 = class {
1402
+ constructor(storagePrefix) {;_class20.prototype.__init25.call(this);_class20.prototype.__init26.call(this);_class20.prototype.__init27.call(this);_class20.prototype.__init28.call(this);_class20.prototype.__init29.call(this);_class20.prototype.__init30.call(this);
1516
1403
  this.storagePrefix = storagePrefix;
1517
1404
  this.initOnce = new Promise((resolve) => {
1518
1405
  this.resolveInitOnce = resolve;
1519
1406
  });
1520
1407
  }
1521
- storagePrefix;
1522
- initOnce;
1408
+
1409
+
1523
1410
  get shapeId() {
1524
- return this._shapeId ?? "";
1525
- }
1526
- _shapeId = null;
1527
- current = null;
1528
- disposed = false;
1529
- initialTree = null;
1530
- listeners = /* @__PURE__ */ new Set();
1531
- resolveInitOnce;
1411
+ return _nullishCoalesce(this._shapeId, () => ( ""));
1412
+ }
1413
+ __init25() {this._shapeId = null}
1414
+ __init26() {this.current = null}
1415
+ __init27() {this.disposed = false}
1416
+ __init28() {this.initialTree = null}
1417
+ __init29() {this.listeners = /* @__PURE__ */ new Set()}
1418
+
1532
1419
  dispose() {
1533
1420
  this.disposed = true;
1534
1421
  this.listeners.clear();
1535
1422
  }
1536
1423
  getTreeSnapshot() {
1537
1424
  if (!this.current) {
1538
- throw new WizardInitializationError("[WizardStore] getTreeSnapshot called before init");
1425
+ throw new (0, _chunkXNH2LQZLcjs.WizardInitializationError)("[WizardStore] getTreeSnapshot called before init");
1539
1426
  }
1540
1427
  return this.current;
1541
1428
  }
@@ -1553,7 +1440,7 @@ var WizardStore = class {
1553
1440
  setState(tree) {
1554
1441
  if (this.disposed) return;
1555
1442
  if (!this.initialTree) {
1556
- throw new WizardInitializationError("[WizardStore] setState called before init");
1443
+ throw new (0, _chunkXNH2LQZLcjs.WizardInitializationError)("[WizardStore] setState called before init");
1557
1444
  }
1558
1445
  if (this.current === tree) return;
1559
1446
  this.current = tree;
@@ -1561,16 +1448,16 @@ var WizardStore = class {
1561
1448
  listener();
1562
1449
  }
1563
1450
  }
1564
- subscribe = (listener) => {
1451
+ __init30() {this.subscribe = (listener) => {
1565
1452
  this.listeners.add(listener);
1566
1453
  return () => {
1567
1454
  this.listeners.delete(listener);
1568
1455
  };
1569
- };
1570
- };
1456
+ }}
1457
+ }, _class20);
1571
1458
 
1572
1459
  // src/core/wizard-engine.ts
1573
- var WizardEngine = class {
1460
+ var WizardEngine = (_class21 = class {
1574
1461
  get configOptions() {
1575
1462
  return this.config.options;
1576
1463
  }
@@ -1592,36 +1479,36 @@ var WizardEngine = class {
1592
1479
  get tree() {
1593
1480
  return this.store.getTreeSnapshot();
1594
1481
  }
1595
- committed = false;
1482
+ __init31() {this.committed = false}
1596
1483
  // commitRegistration() entered
1597
- config;
1598
- disposed = false;
1599
- initialBranch;
1600
- initialized = false;
1484
+
1485
+ __init32() {this.disposed = false}
1486
+
1487
+ __init33() {this.initialized = false}
1601
1488
  // store.init() ran successfully
1602
- initialState;
1603
- initService;
1604
- listeners;
1605
- log;
1489
+
1490
+
1491
+
1492
+
1606
1493
  // ------------- snapshots -------------
1607
- navService;
1608
- pendingPostInitTasks = [];
1609
- progressStrategy;
1610
- scrollStrategy;
1611
- stateService;
1612
- store;
1613
- visibilityStrategy;
1614
- constructor(options) {
1615
- this.config = new WizardConfig(options.config ?? {});
1616
- const storagePrefix = options.config?.storagePrefix ?? void 0;
1494
+
1495
+ __init34() {this.pendingPostInitTasks = []}
1496
+
1497
+
1498
+
1499
+
1500
+
1501
+ constructor(options) {;_class21.prototype.__init31.call(this);_class21.prototype.__init32.call(this);_class21.prototype.__init33.call(this);_class21.prototype.__init34.call(this);_class21.prototype.__init35.call(this);_class21.prototype.__init36.call(this);
1502
+ this.config = new WizardConfig(_nullishCoalesce(options.config, () => ( {})));
1503
+ const storagePrefix = _nullishCoalesce(_optionalChain([options, 'access', _25 => _25.config, 'optionalAccess', _26 => _26.storagePrefix]), () => ( void 0));
1617
1504
  this.store = new WizardStore(storagePrefix);
1618
1505
  this.log = new WizardLog(this.config);
1619
- this.scrollStrategy = options.strategies?.scroll ?? new WizardSmoothScrollStrategy(this.config);
1506
+ this.scrollStrategy = _nullishCoalesce(_optionalChain([options, 'access', _27 => _27.strategies, 'optionalAccess', _28 => _28.scroll]), () => ( new WizardSmoothScrollStrategy(this.config)));
1620
1507
  if (options.scrollContainer !== void 0) {
1621
1508
  this.scrollStrategy.setContainer(options.scrollContainer);
1622
1509
  }
1623
- this.visibilityStrategy = options.strategies?.visibility ?? new WizardDefaultVisibilityStrategy(this.config);
1624
- this.progressStrategy = options.strategies?.progress ?? new WizardActiveProgressStrategy();
1510
+ this.visibilityStrategy = _nullishCoalesce(_optionalChain([options, 'access', _29 => _29.strategies, 'optionalAccess', _30 => _30.visibility]), () => ( new WizardDefaultVisibilityStrategy(this.config)));
1511
+ this.progressStrategy = _nullishCoalesce(_optionalChain([options, 'access', _31 => _31.strategies, 'optionalAccess', _32 => _32.progress]), () => ( new WizardActiveProgressStrategy()));
1625
1512
  this.stateService = new WizardStateService(this.store, this.config);
1626
1513
  this.navService = new WizardNavigationService(
1627
1514
  this.store,
@@ -1629,9 +1516,9 @@ var WizardEngine = class {
1629
1516
  this.stateService,
1630
1517
  this.scrollStrategy
1631
1518
  );
1632
- const initializers = options.initializers ?? [new WizardDefaultInitializer()];
1519
+ const initializers = _nullishCoalesce(options.initializers, () => ( [new WizardDefaultInitializer()]));
1633
1520
  this.initService = new WizardInitializerService(this.log, initializers);
1634
- this.listeners = options.listeners ?? [];
1521
+ this.listeners = _nullishCoalesce(options.listeners, () => ( []));
1635
1522
  this.initialState = options.state;
1636
1523
  this.initialBranch = options.activeBranch;
1637
1524
  }
@@ -1707,7 +1594,7 @@ var WizardEngine = class {
1707
1594
  exitWizard() {
1708
1595
  return this.runOrQueue(() => this.navService.exitWizard());
1709
1596
  }
1710
- getTreeSnapshot = () => this.store.getTreeSnapshot();
1597
+ __init35() {this.getTreeSnapshot = () => this.store.getTreeSnapshot()}
1711
1598
  go(tree) {
1712
1599
  return this.runOrQueue(() => this.navService.navigate(tree));
1713
1600
  }
@@ -1727,10 +1614,10 @@ var WizardEngine = class {
1727
1614
  return this.visibilityStrategy.isStepVisible(step, tree);
1728
1615
  }
1729
1616
  next(branch) {
1730
- return this.runOrQueue(() => this.navService.navigate(this.stateService.next(branch ?? null)));
1617
+ return this.runOrQueue(() => this.navService.navigate(this.stateService.next(_nullishCoalesce(branch, () => ( null)))));
1731
1618
  }
1732
1619
  nextCategory(branch) {
1733
- return this.runOrQueue(() => this.navService.navigate(this.stateService.nextCategory(branch ?? null)));
1620
+ return this.runOrQueue(() => this.navService.navigate(this.stateService.nextCategory(_nullishCoalesce(branch, () => ( null)))));
1734
1621
  }
1735
1622
  on(type, handler) {
1736
1623
  return this.navService.on(type, handler);
@@ -1762,10 +1649,10 @@ var WizardEngine = class {
1762
1649
  }
1763
1650
  skipCategory(category) {
1764
1651
  return this.runOrQueue(
1765
- () => this.navService.navigate(this.stateService.skipCategory(category ?? this.tree.activeCategory.id))
1652
+ () => this.navService.navigate(this.stateService.skipCategory(_nullishCoalesce(category, () => ( this.tree.activeCategory.id))))
1766
1653
  );
1767
1654
  }
1768
- subscribe = (listener) => this.store.subscribe(listener);
1655
+ __init36() {this.subscribe = (listener) => this.store.subscribe(listener)}
1769
1656
  toggleCategory(category, show) {
1770
1657
  return show ? this.showCategory(category) : this.hideCategory(category);
1771
1658
  }
@@ -1790,7 +1677,7 @@ var WizardEngine = class {
1790
1677
  }
1791
1678
  return action();
1792
1679
  }
1793
- };
1680
+ }, _class21);
1794
1681
 
1795
1682
  // src/enums/wizard-category-direction.enum.ts
1796
1683
  var WizardCategoryDirection = /* @__PURE__ */ ((WizardCategoryDirection2) => {
@@ -1799,66 +1686,27 @@ var WizardCategoryDirection = /* @__PURE__ */ ((WizardCategoryDirection2) => {
1799
1686
  return WizardCategoryDirection2;
1800
1687
  })(WizardCategoryDirection || {});
1801
1688
 
1802
- // src/react/components-provider.tsx
1803
- var import_react = require("react");
1804
- var import_jsx_runtime = require("react/jsx-runtime");
1805
- var FallbackButton = (props) => {
1806
- const { children, asChild: _asChild, variant: _variant, size: _size, ...rest } = props;
1807
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { ...rest, type: props.type ?? "button", children });
1808
- };
1809
- var FallbackBackArrowIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className, width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 4 L6 8 L10 12", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) });
1810
- var defaults = { Button: FallbackButton, BackArrowIcon: FallbackBackArrowIcon };
1811
- var WizardComponentsContext = (0, import_react.createContext)(defaults);
1812
- function WizardComponentsProvider(props) {
1813
- const { Button, BackArrowIcon, children } = props;
1814
- const value = {
1815
- Button: Button ?? defaults.Button,
1816
- BackArrowIcon: BackArrowIcon ?? defaults.BackArrowIcon
1817
- };
1818
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WizardComponentsContext.Provider, { value, children });
1819
- }
1820
- function useWizardComponents() {
1821
- return (0, import_react.useContext)(WizardComponentsContext);
1822
- }
1823
-
1824
- // src/react/use-wizard.ts
1825
- var import_react3 = require("react");
1826
-
1827
- // src/react/context.ts
1828
- var import_react2 = require("react");
1829
- var WizardEngineContext = (0, import_react2.createContext)(null);
1830
-
1831
- // src/react/use-wizard.ts
1832
- function useWizard() {
1833
- const engine = (0, import_react3.useContext)(WizardEngineContext);
1834
- if (!engine) {
1835
- throw new WizardError("useWizard must be used inside <WizardProvider>");
1836
- }
1837
- (0, import_react3.useSyncExternalStore)(engine.subscribe, engine.getTreeSnapshot, engine.getTreeSnapshot);
1838
- return engine;
1839
- }
1840
-
1841
1689
  // src/react/components/wizard-action-button.tsx
1842
- var import_react_slot = require("@radix-ui/react-slot");
1843
- var import_jsx_runtime2 = require("react/jsx-runtime");
1690
+ var _reactslot = require('@radix-ui/react-slot');
1691
+ var _jsxruntime = require('react/jsx-runtime');
1844
1692
  function WizardActionButton(props) {
1845
- const { Button } = useWizardComponents();
1693
+ const { Button } = _chunkXNH2LQZLcjs.useWizardComponents.call(void 0, );
1846
1694
  if (props.asChild) {
1847
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_slot.Slot, { className: props.className, onClick: props.onClick, children: props.children });
1695
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactslot.Slot, { className: props.className, onClick: props.onClick, children: props.children });
1848
1696
  }
1849
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { className: props.className, onClick: props.onClick, type: "button", variant: props.variant, children: props.children ?? props.defaultLabel });
1697
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { className: props.className, onClick: props.onClick, type: "button", variant: props.variant, children: _nullishCoalesce(props.children, () => ( props.defaultLabel)) });
1850
1698
  }
1851
1699
 
1852
1700
  // src/react/components/wizard-back.tsx
1853
- var import_jsx_runtime3 = require("react/jsx-runtime");
1701
+
1854
1702
  function WizardBack(props) {
1855
- const wizard = useWizard();
1856
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1703
+ const wizard = _chunkXNH2LQZLcjs.useWizard.call(void 0, );
1704
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1857
1705
  WizardActionButton,
1858
1706
  {
1859
1707
  asChild: props.asChild,
1860
1708
  className: props.className,
1861
- defaultLabel: wizard.configOptions.backBtnText ?? "Back",
1709
+ defaultLabel: _nullishCoalesce(wizard.configOptions.backBtnText, () => ( "Back")),
1862
1710
  onClick: () => void wizard.back(),
1863
1711
  variant: "ghost",
1864
1712
  children: props.children
@@ -1867,33 +1715,26 @@ function WizardBack(props) {
1867
1715
  }
1868
1716
 
1869
1717
  // src/react/components/wizard-category.tsx
1870
- var import_jsx_runtime4 = require("react/jsx-runtime");
1718
+
1871
1719
  function WizardCategory(props) {
1872
- const wizard = useWizard();
1720
+ const wizard = _chunkXNH2LQZLcjs.useWizard.call(void 0, );
1873
1721
  if (wizard.tree.activeCategory.id !== props.categoryId) return null;
1874
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: props.children });
1875
- }
1876
-
1877
- // src/utils/cn.ts
1878
- var import_clsx = require("clsx");
1879
- var import_tailwind_merge = require("tailwind-merge");
1880
- function cn(...inputs) {
1881
- return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(...inputs));
1722
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: props.children });
1882
1723
  }
1883
1724
 
1884
1725
  // src/react/components/wizard-stepper-dot.tsx
1885
- var import_lucide_react = require("lucide-react");
1886
- var import_jsx_runtime5 = require("react/jsx-runtime");
1726
+ var _lucidereact = require('lucide-react');
1727
+
1887
1728
  function WizardStepperDot(props) {
1888
1729
  const { clickable = false, isLast = false, label, onClick, progress, state } = props;
1889
1730
  const isInteractive = clickable && !!onClick;
1890
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { className: "relative flex flex-1 items-center", "data-state": state, children: [
1891
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1731
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { className: "relative flex flex-1 items-center", "data-state": state, children: [
1732
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1892
1733
  "button",
1893
1734
  {
1894
1735
  "aria-current": state === "active" ? "step" : void 0,
1895
- "aria-label": label ?? state,
1896
- className: cn(
1736
+ "aria-label": _nullishCoalesce(label, () => ( state)),
1737
+ className: _chunkXNH2LQZLcjs.cn.call(void 0,
1897
1738
  "relative flex size-3 shrink-0 items-center justify-center rounded-full border-2 transition-colors",
1898
1739
  state === "pending" && "border-border bg-background",
1899
1740
  state === "active" && "border-success-text bg-success-text ring-2 ring-success-border/40 ring-offset-2 ring-offset-background",
@@ -1905,20 +1746,20 @@ function WizardStepperDot(props) {
1905
1746
  disabled: !isInteractive,
1906
1747
  onClick: isInteractive ? onClick : void 0,
1907
1748
  type: "button",
1908
- children: state === "completed" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.CheckIcon, { className: "size-2 text-background" })
1749
+ children: state === "completed" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CheckIcon, { className: "size-2 text-background" })
1909
1750
  }
1910
1751
  ),
1911
- !isLast && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-hidden": true, className: "relative ml-1 mr-1 h-px flex-1 bg-border", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1752
+ !isLast && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "aria-hidden": true, className: "relative ml-1 mr-1 h-px flex-1 bg-border", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1912
1753
  "span",
1913
1754
  {
1914
1755
  className: "absolute inset-y-0 left-0 bg-success-border transition-[width]",
1915
1756
  style: { width: `${Math.max(0, Math.min(100, progress))}%` }
1916
1757
  }
1917
1758
  ) }),
1918
- label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1759
+ label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1919
1760
  "span",
1920
1761
  {
1921
- className: cn(
1762
+ className: _chunkXNH2LQZLcjs.cn.call(void 0,
1922
1763
  "absolute -top-6 left-0 -translate-x-[calc(50%-0.375rem)] text-sm font-semibold whitespace-nowrap",
1923
1764
  state === "active" && "text-success-text",
1924
1765
  state !== "active" && "text-muted-foreground"
@@ -1930,28 +1771,28 @@ function WizardStepperDot(props) {
1930
1771
  }
1931
1772
 
1932
1773
  // src/react/components/wizard-stepper.tsx
1933
- var import_jsx_runtime6 = require("react/jsx-runtime");
1774
+
1934
1775
  function WizardStepper(props) {
1935
1776
  const { canAccessCategory, categories, doneDot, headerI18n, onCategoryClick, progress } = props;
1936
1777
  const lastIdx = categories.length - 1;
1937
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("ol", { "aria-label": "Wizard progress", className: "relative flex flex-1 items-center pt-6", children: [
1778
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "ol", { "aria-label": "Wizard progress", className: "relative flex flex-1 items-center pt-6", children: [
1938
1779
  categories.map((category, idx) => {
1939
1780
  const isLast = idx === lastIdx && !doneDot;
1940
- const clickable = canAccessCategory?.(category) ?? false;
1941
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1781
+ const clickable = _nullishCoalesce(_optionalChain([canAccessCategory, 'optionalCall', _33 => _33(category)]), () => ( false));
1782
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1942
1783
  WizardStepperDot,
1943
1784
  {
1944
1785
  clickable,
1945
1786
  isLast,
1946
- label: headerI18n?.[category.id],
1787
+ label: _optionalChain([headerI18n, 'optionalAccess', _34 => _34[category.id]]),
1947
1788
  onClick: onCategoryClick ? () => onCategoryClick(category) : void 0,
1948
- progress: progress[category.id] ?? 0,
1949
- state: getDotState(category, progress[category.id] ?? 0)
1789
+ progress: _nullishCoalesce(progress[category.id], () => ( 0)),
1790
+ state: getDotState(category, _nullishCoalesce(progress[category.id], () => ( 0)))
1950
1791
  },
1951
1792
  category.id
1952
1793
  );
1953
1794
  }),
1954
- doneDot && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(WizardStepperDot, { isLast: true, label: doneDot.text, progress: 0, state: "pending" })
1795
+ doneDot && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardStepperDot, { isLast: true, label: doneDot.text, progress: 0, state: "pending" })
1955
1796
  ] });
1956
1797
  }
1957
1798
  function getDotState(category, progress) {
@@ -1962,9 +1803,9 @@ function getDotState(category, progress) {
1962
1803
  }
1963
1804
 
1964
1805
  // src/react/components/wizard-header.tsx
1965
- var import_jsx_runtime7 = require("react/jsx-runtime");
1806
+
1966
1807
  function WizardHeader() {
1967
- const wizard = useWizard();
1808
+ const wizard = _chunkXNH2LQZLcjs.useWizard.call(void 0, );
1968
1809
  const tree = wizard.tree;
1969
1810
  const config = wizard.configOptions;
1970
1811
  if (!config.isShowWizardHeader) return null;
@@ -1975,7 +1816,7 @@ function WizardHeader() {
1975
1816
  if (config.isBackResetCompleted) return false;
1976
1817
  if (category.isCompleted) return true;
1977
1818
  const idx = tree.activeBranch.shownCategories.indexOf(category);
1978
- return !!tree.activeBranch.shownCategories[idx - 1]?.isCompleted;
1819
+ return !!_optionalChain([tree, 'access', _35 => _35.activeBranch, 'access', _36 => _36.shownCategories, 'access', _37 => _37[idx - 1], 'optionalAccess', _38 => _38.isCompleted]);
1979
1820
  };
1980
1821
  const onCategoryClick = (category) => {
1981
1822
  if (config.isBackResetCompleted) return;
@@ -1992,16 +1833,16 @@ function WizardHeader() {
1992
1833
  void wizard.goToCategory(category.id);
1993
1834
  }
1994
1835
  };
1995
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1836
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1996
1837
  "header",
1997
1838
  {
1998
- className: cn(
1839
+ className: _chunkXNH2LQZLcjs.cn.call(void 0,
1999
1840
  "relative mb-8 flex items-center gap-4 border-b border-border bg-background px-4 py-3",
2000
1841
  config.stickyHeader && "sticky top-0 z-10"
2001
1842
  ),
2002
1843
  children: [
2003
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WizardBack, {}),
2004
- showSteps && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1844
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardBack, {}),
1845
+ showSteps && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2005
1846
  WizardStepper,
2006
1847
  {
2007
1848
  canAccessCategory,
@@ -2018,11 +1859,11 @@ function WizardHeader() {
2018
1859
  }
2019
1860
 
2020
1861
  // src/react/components/wizard-next.tsx
2021
- var import_jsx_runtime8 = require("react/jsx-runtime");
1862
+
2022
1863
  function WizardNext(props) {
2023
- const wizard = useWizard();
1864
+ const wizard = _chunkXNH2LQZLcjs.useWizard.call(void 0, );
2024
1865
  const defaultLabel = !props.asChild && props.children === void 0 ? getNextLabel(wizard) : "";
2025
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1866
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2026
1867
  WizardActionButton,
2027
1868
  {
2028
1869
  asChild: props.asChild,
@@ -2045,12 +1886,12 @@ function getNextLabel(wizard) {
2045
1886
  }
2046
1887
 
2047
1888
  // src/react/components/wizard-rail.tsx
2048
- var import_lucide_react2 = require("lucide-react");
1889
+
2049
1890
 
2050
1891
  // src/react/hooks/use-wizard-categories-view.ts
2051
1892
  var EMPTY_SUB_STEPS = [];
2052
1893
  function useWizardCategoriesView() {
2053
- const wizard = useWizard();
1894
+ const wizard = _chunkXNH2LQZLcjs.useWizard.call(void 0, );
2054
1895
  return wizard.tree.activeBranch.shownCategories.map((category) => projectCategory(category));
2055
1896
  }
2056
1897
  function getCategoryState(category) {
@@ -2071,34 +1912,34 @@ function projectCategory(category) {
2071
1912
  }
2072
1913
 
2073
1914
  // src/react/components/wizard-rail.tsx
2074
- var import_jsx_runtime9 = require("react/jsx-runtime");
1915
+
2075
1916
  function WizardRail(props) {
2076
1917
  const { canAccessCategory, className, headerI18n, subStepLabels } = props;
2077
- const wizard = useWizard();
1918
+ const wizard = _chunkXNH2LQZLcjs.useWizard.call(void 0, );
2078
1919
  const view = useWizardCategoriesView();
2079
- const labels = headerI18n ?? wizard.configOptions.headerI18n;
2080
- const isClickable = (category) => canAccessCategory?.(category) ?? defaultClickable(category.state);
2081
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("nav", { "aria-label": "Wizard steps", className: cn("flex flex-col gap-1", className), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ol", { className: "relative flex flex-col gap-1", children: view.map((category, idx) => {
2082
- const label = labels?.[category.id] ?? String(category.id);
1920
+ const labels = _nullishCoalesce(headerI18n, () => ( wizard.configOptions.headerI18n));
1921
+ const isClickable = (category) => _nullishCoalesce(_optionalChain([canAccessCategory, 'optionalCall', _39 => _39(category)]), () => ( defaultClickable(category.state)));
1922
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "nav", { "aria-label": "Wizard steps", className: _chunkXNH2LQZLcjs.cn.call(void 0, "flex flex-col gap-1", className), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: "relative flex flex-col gap-1", children: view.map((category, idx) => {
1923
+ const label = _nullishCoalesce(_optionalChain([labels, 'optionalAccess', _40 => _40[category.id]]), () => ( String(category.id)));
2083
1924
  const clickable = isClickable(category);
2084
1925
  const isLast = idx === view.length - 1;
2085
1926
  const isPassed = category.state === "completed" || category.state === "skipped";
2086
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { className: "relative", children: [
2087
- !isLast && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1927
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { className: "relative", children: [
1928
+ !isLast && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2088
1929
  "span",
2089
1930
  {
2090
1931
  "aria-hidden": true,
2091
- className: cn(
1932
+ className: _chunkXNH2LQZLcjs.cn.call(void 0,
2092
1933
  "pointer-events-none absolute top-7 -bottom-2 left-5 w-px -translate-x-1/2 transition-colors duration-200",
2093
1934
  isPassed ? "bg-success-border" : "bg-border"
2094
1935
  )
2095
1936
  }
2096
1937
  ),
2097
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1938
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2098
1939
  "button",
2099
1940
  {
2100
1941
  "aria-current": category.isActive ? "step" : void 0,
2101
- className: cn(
1942
+ className: _chunkXNH2LQZLcjs.cn.call(void 0,
2102
1943
  "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)",
2103
1944
  category.state === "active" && "bg-success-bg/60 text-success-text",
2104
1945
  category.state === "completed" && "text-foreground",
@@ -2113,20 +1954,20 @@ function WizardRail(props) {
2113
1954
  },
2114
1955
  type: "button",
2115
1956
  children: [
2116
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RailDot, { state: category.state }),
2117
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label })
1957
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RailDot, { state: category.state }),
1958
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: label })
2118
1959
  ]
2119
1960
  }
2120
1961
  ),
2121
- category.isActive && category.subSteps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ol", { className: "mt-1 ml-7 flex flex-col gap-1 border-l border-border pl-3", children: category.subSteps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1962
+ category.isActive && category.subSteps.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: "mt-1 ml-7 flex flex-col gap-1 border-l border-border pl-3", children: category.subSteps.map((step) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2122
1963
  "li",
2123
1964
  {
2124
1965
  "aria-current": step.isActive ? "step" : void 0,
2125
- className: cn(
1966
+ className: _chunkXNH2LQZLcjs.cn.call(void 0,
2126
1967
  "rounded px-2 py-1 text-sm",
2127
1968
  step.isActive ? "text-success-text font-medium" : "text-muted-foreground"
2128
1969
  ),
2129
- children: subStepLabels?.[step.id] ?? String(step.id)
1970
+ children: _nullishCoalesce(_optionalChain([subStepLabels, 'optionalAccess', _41 => _41[step.id]]), () => ( String(step.id)))
2130
1971
  },
2131
1972
  step.id
2132
1973
  )) })
@@ -2137,34 +1978,34 @@ function defaultClickable(state) {
2137
1978
  return state !== "pending";
2138
1979
  }
2139
1980
  function RailDot({ state }) {
2140
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1981
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2141
1982
  "span",
2142
1983
  {
2143
1984
  "aria-hidden": true,
2144
- className: cn(
1985
+ className: _chunkXNH2LQZLcjs.cn.call(void 0,
2145
1986
  "flex size-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors",
2146
1987
  state === "pending" && "border-border bg-background",
2147
1988
  state === "active" && "border-success-border bg-success-bg",
2148
1989
  state === "completed" && "border-success-border bg-success-text",
2149
1990
  state === "skipped" && "border-border bg-background opacity-60"
2150
1991
  ),
2151
- children: state === "completed" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.CheckIcon, { className: "size-2.5 text-background motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-75 motion-safe:duration-200" })
1992
+ children: state === "completed" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CheckIcon, { className: "size-2.5 text-background motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-75 motion-safe:duration-200" })
2152
1993
  }
2153
1994
  );
2154
1995
  }
2155
1996
 
2156
1997
  // src/react/components/wizard-step.tsx
2157
- var import_react4 = require("react");
2158
- var import_jsx_runtime10 = require("react/jsx-runtime");
1998
+ var _react = require('react');
1999
+
2159
2000
  function WizardStep(props) {
2160
- const engine = (0, import_react4.useContext)(WizardEngineContext);
2001
+ const engine = _react.useContext.call(void 0, _chunkXNH2LQZLcjs.WizardEngineContext);
2161
2002
  if (!engine) {
2162
- throw new WizardError("WizardStep must be used inside <WizardProvider>");
2003
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)("WizardStep must be used inside <WizardProvider>");
2163
2004
  }
2164
- const getSnapshot = (0, import_react4.useCallback)(() => engine.isStepVisible(props.id), [engine, props.id]);
2165
- const isVisible = (0, import_react4.useSyncExternalStore)(engine.subscribe, getSnapshot, getSnapshot);
2005
+ const getSnapshot = _react.useCallback.call(void 0, () => engine.isStepVisible(props.id), [engine, props.id]);
2006
+ const isVisible = _react.useSyncExternalStore.call(void 0, engine.subscribe, getSnapshot, getSnapshot);
2166
2007
  if (!isVisible) return null;
2167
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2008
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2168
2009
  "div",
2169
2010
  {
2170
2011
  className: "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)",
@@ -2175,11 +2016,11 @@ function WizardStep(props) {
2175
2016
  }
2176
2017
 
2177
2018
  // src/react/provider.tsx
2178
- var import_react5 = require("react");
2179
- var import_jsx_runtime11 = require("react/jsx-runtime");
2019
+
2020
+
2180
2021
  function WizardProvider(props) {
2181
2022
  const { activeBranch, children, config, initializers, listeners, scrollContainer, state, strategies } = props;
2182
- const [bootOptions] = (0, import_react5.useState)(() => ({
2023
+ const [bootOptions] = _react.useState.call(void 0, () => ({
2183
2024
  activeBranch,
2184
2025
  config,
2185
2026
  initializers,
@@ -2188,8 +2029,8 @@ function WizardProvider(props) {
2188
2029
  state,
2189
2030
  strategies
2190
2031
  }));
2191
- const [engine, setEngine] = (0, import_react5.useState)(null);
2192
- (0, import_react5.useEffect)(() => {
2032
+ const [engine, setEngine] = _react.useState.call(void 0, null);
2033
+ _react.useEffect.call(void 0, () => {
2193
2034
  const newEngine = new WizardEngine(bootOptions);
2194
2035
  let cancelled = false;
2195
2036
  newEngine.commitRegistration().then(() => {
@@ -2204,19 +2045,19 @@ function WizardProvider(props) {
2204
2045
  if (!engine) {
2205
2046
  return null;
2206
2047
  }
2207
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(WizardEngineContext.Provider, { value: engine, children });
2048
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXNH2LQZLcjs.WizardEngineContext.Provider, { value: engine, children });
2208
2049
  }
2209
2050
 
2210
2051
  // src/react/use-wizard-engine-ref.ts
2211
- var import_react6 = require("react");
2052
+
2212
2053
  function useWizardEngineRef() {
2213
- return (0, import_react6.useRef)(null);
2054
+ return _react.useRef.call(void 0, null);
2214
2055
  }
2215
2056
  function WizardEngineRefCapture({
2216
2057
  engineRef
2217
2058
  }) {
2218
- const wizard = useWizard();
2219
- (0, import_react6.useEffect)(() => {
2059
+ const wizard = _chunkXNH2LQZLcjs.useWizard.call(void 0, );
2060
+ _react.useEffect.call(void 0, () => {
2220
2061
  engineRef.current = wizard;
2221
2062
  return () => {
2222
2063
  engineRef.current = null;
@@ -2226,32 +2067,32 @@ function WizardEngineRefCapture({
2226
2067
  }
2227
2068
 
2228
2069
  // src/react/use-wizard-event.ts
2229
- var import_react7 = require("react");
2070
+
2230
2071
  function useWizardEvent(type, handler) {
2231
- const engine = (0, import_react7.useContext)(WizardEngineContext);
2072
+ const engine = _react.useContext.call(void 0, _chunkXNH2LQZLcjs.WizardEngineContext);
2232
2073
  if (!engine) {
2233
- throw new WizardError("useWizardEvent must be used inside <WizardProvider>");
2074
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)("useWizardEvent must be used inside <WizardProvider>");
2234
2075
  }
2235
- const handlerRef = (0, import_react7.useRef)(handler);
2236
- (0, import_react7.useEffect)(() => {
2076
+ const handlerRef = _react.useRef.call(void 0, handler);
2077
+ _react.useEffect.call(void 0, () => {
2237
2078
  handlerRef.current = handler;
2238
2079
  });
2239
- (0, import_react7.useEffect)(() => {
2080
+ _react.useEffect.call(void 0, () => {
2240
2081
  return engine.on(type, (event) => handlerRef.current(event));
2241
2082
  }, [engine, type]);
2242
2083
  }
2243
2084
 
2244
2085
  // src/react/use-wizard-step.ts
2245
- var import_react8 = require("react");
2086
+
2246
2087
  function useWizardStep(stepId) {
2247
- const engine = (0, import_react8.useContext)(WizardEngineContext);
2088
+ const engine = _react.useContext.call(void 0, _chunkXNH2LQZLcjs.WizardEngineContext);
2248
2089
  if (!engine) {
2249
- throw new WizardError("useWizardStep must be used inside <WizardProvider>");
2090
+ throw new (0, _chunkXNH2LQZLcjs.WizardError)("useWizardStep must be used inside <WizardProvider>");
2250
2091
  }
2251
- const lastRef = (0, import_react8.useRef)(null);
2252
- const getSnapshot = (0, import_react8.useCallback)(() => {
2092
+ const lastRef = _react.useRef.call(void 0, null);
2093
+ const getSnapshot = _react.useCallback.call(void 0, () => {
2253
2094
  const tree = engine.getTreeSnapshot();
2254
- const next = tree.stepMap[stepId] ?? null;
2095
+ const next = _nullishCoalesce(tree.stepMap[stepId], () => ( null));
2255
2096
  const prev = lastRef.current;
2256
2097
  if (prev !== null && next !== null && prev.isActive === next.isActive && prev.isShow === next.isShow && prev.isCompleted === next.isCompleted && prev.isSkipped === next.isSkipped) {
2257
2098
  return prev;
@@ -2259,91 +2100,90 @@ function useWizardStep(stepId) {
2259
2100
  lastRef.current = next;
2260
2101
  return next;
2261
2102
  }, [engine, stepId]);
2262
- return (0, import_react8.useSyncExternalStore)(engine.subscribe, getSnapshot, getSnapshot);
2103
+ return _react.useSyncExternalStore.call(void 0, engine.subscribe, getSnapshot, getSnapshot);
2263
2104
  }
2264
- // Annotate the CommonJS export names for ESM import in node:
2265
- 0 && (module.exports = {
2266
- TypedEmitter,
2267
- WizardActiveProgressStrategy,
2268
- WizardActiveStepRule,
2269
- WizardBack,
2270
- WizardCategory,
2271
- WizardCategoryDirection,
2272
- WizardCompleteEvent,
2273
- WizardCompleteTreeState,
2274
- WizardComponentsProvider,
2275
- WizardConfig,
2276
- WizardDefaultInitializer,
2277
- WizardDefaultVisibilityStrategy,
2278
- WizardEngine,
2279
- WizardEngineContext,
2280
- WizardEngineRefCapture,
2281
- WizardError,
2282
- WizardEvent,
2283
- WizardEventType,
2284
- WizardExitEvent,
2285
- WizardExitTreeState,
2286
- WizardHeader,
2287
- WizardInitializationError,
2288
- WizardInitializer,
2289
- WizardInitializerService,
2290
- WizardLastActiveVisibilityStrategy,
2291
- WizardListener,
2292
- WizardLog,
2293
- WizardNavigation,
2294
- WizardNavigationCancelledEvent,
2295
- WizardNavigationEndEvent,
2296
- WizardNavigationError,
2297
- WizardNavigationErrorEvent,
2298
- WizardNavigationIgnoredEvent,
2299
- WizardNavigationService,
2300
- WizardNavigationStartEvent,
2301
- WizardNext,
2302
- WizardPassedPrevCategoriesRule,
2303
- WizardPassedPrevStepsRule,
2304
- WizardProgressStrategy,
2305
- WizardProvider,
2306
- WizardRail,
2307
- WizardResolveEndEvent,
2308
- WizardResolveStartEvent,
2309
- WizardResolverError,
2310
- WizardRule,
2311
- WizardScrollEndEvent,
2312
- WizardScrollStartEvent,
2313
- WizardScrollStrategy,
2314
- WizardShownActiveCategoryRule,
2315
- WizardSingleActiveCategoryRule,
2316
- WizardSmoothScrollStrategy,
2317
- WizardStateService,
2318
- WizardStep,
2319
- WizardStepHideEvent,
2320
- WizardStepShowEvent,
2321
- WizardStepper,
2322
- WizardStepperDot,
2323
- WizardStore,
2324
- WizardTreeStateBuilder,
2325
- WizardVisibilityStrategy,
2326
- buildWizardBranchState,
2327
- buildWizardCategoryState,
2328
- buildWizardTreeState,
2329
- composeWizardProviders,
2330
- scrollToStep,
2331
- useWizard,
2332
- useWizardCategoriesView,
2333
- useWizardComponents,
2334
- useWizardEngineRef,
2335
- useWizardEvent,
2336
- useWizardStep,
2337
- withConfig,
2338
- withInitializer,
2339
- withListener,
2340
- withProgressStrategy,
2341
- withScrollContainer,
2342
- withScrollStrategy,
2343
- withVisibilityStrategy,
2344
- wizardDefaultBranch,
2345
- wizardDefaultConfig,
2346
- wizardDefaultState,
2347
- wizardRules
2348
- });
2105
+
2106
+
2107
+
2108
+
2109
+
2110
+
2111
+
2112
+
2113
+
2114
+
2115
+
2116
+
2117
+
2118
+
2119
+
2120
+
2121
+
2122
+
2123
+
2124
+
2125
+
2126
+
2127
+
2128
+
2129
+
2130
+
2131
+
2132
+
2133
+
2134
+
2135
+
2136
+
2137
+
2138
+
2139
+
2140
+
2141
+
2142
+
2143
+
2144
+
2145
+
2146
+
2147
+
2148
+
2149
+
2150
+
2151
+
2152
+
2153
+
2154
+
2155
+
2156
+
2157
+
2158
+
2159
+
2160
+
2161
+
2162
+
2163
+
2164
+
2165
+
2166
+
2167
+
2168
+
2169
+
2170
+
2171
+
2172
+
2173
+
2174
+
2175
+
2176
+
2177
+
2178
+
2179
+
2180
+
2181
+
2182
+
2183
+
2184
+
2185
+
2186
+
2187
+
2188
+ exports.TypedEmitter = TypedEmitter; exports.WizardActiveProgressStrategy = WizardActiveProgressStrategy; exports.WizardActiveStepRule = WizardActiveStepRule; exports.WizardBack = WizardBack; exports.WizardCategory = WizardCategory; exports.WizardCategoryDirection = WizardCategoryDirection; exports.WizardCompleteEvent = WizardCompleteEvent; exports.WizardCompleteTreeState = WizardCompleteTreeState; exports.WizardComponentsProvider = _chunkXNH2LQZLcjs.WizardComponentsProvider; exports.WizardConfig = WizardConfig; exports.WizardDefaultInitializer = WizardDefaultInitializer; exports.WizardDefaultVisibilityStrategy = WizardDefaultVisibilityStrategy; exports.WizardEngine = WizardEngine; exports.WizardEngineContext = _chunkXNH2LQZLcjs.WizardEngineContext; exports.WizardEngineRefCapture = WizardEngineRefCapture; exports.WizardError = _chunkXNH2LQZLcjs.WizardError; exports.WizardEvent = WizardEvent; exports.WizardEventType = WizardEventType; exports.WizardExitEvent = WizardExitEvent; exports.WizardExitTreeState = WizardExitTreeState; exports.WizardHeader = WizardHeader; exports.WizardInitializationError = _chunkXNH2LQZLcjs.WizardInitializationError; exports.WizardInitializer = WizardInitializer; exports.WizardInitializerService = WizardInitializerService; exports.WizardLastActiveVisibilityStrategy = WizardLastActiveVisibilityStrategy; exports.WizardListener = WizardListener; exports.WizardLog = WizardLog; exports.WizardNavigation = WizardNavigation; exports.WizardNavigationCancelledEvent = WizardNavigationCancelledEvent; exports.WizardNavigationEndEvent = WizardNavigationEndEvent; exports.WizardNavigationError = _chunkXNH2LQZLcjs.WizardNavigationError; exports.WizardNavigationErrorEvent = WizardNavigationErrorEvent; exports.WizardNavigationIgnoredEvent = WizardNavigationIgnoredEvent; exports.WizardNavigationService = WizardNavigationService; exports.WizardNavigationStartEvent = WizardNavigationStartEvent; exports.WizardNext = WizardNext; exports.WizardPassedPrevCategoriesRule = WizardPassedPrevCategoriesRule; exports.WizardPassedPrevStepsRule = WizardPassedPrevStepsRule; exports.WizardProgressStrategy = WizardProgressStrategy; exports.WizardProvider = WizardProvider; exports.WizardRail = WizardRail; exports.WizardResolveEndEvent = WizardResolveEndEvent; exports.WizardResolveStartEvent = WizardResolveStartEvent; exports.WizardResolverError = _chunkXNH2LQZLcjs.WizardResolverError; exports.WizardRule = WizardRule; exports.WizardScrollEndEvent = WizardScrollEndEvent; exports.WizardScrollStartEvent = WizardScrollStartEvent; exports.WizardScrollStrategy = WizardScrollStrategy; exports.WizardShownActiveCategoryRule = WizardShownActiveCategoryRule; exports.WizardSingleActiveCategoryRule = WizardSingleActiveCategoryRule; exports.WizardSmoothScrollStrategy = WizardSmoothScrollStrategy; exports.WizardStateService = WizardStateService; exports.WizardStep = WizardStep; exports.WizardStepHideEvent = WizardStepHideEvent; exports.WizardStepShowEvent = WizardStepShowEvent; exports.WizardStepper = WizardStepper; exports.WizardStepperDot = WizardStepperDot; exports.WizardStore = WizardStore; exports.WizardTreeStateBuilder = WizardTreeStateBuilder; exports.WizardVisibilityStrategy = WizardVisibilityStrategy; exports.buildWizardBranchState = buildWizardBranchState; exports.buildWizardCategoryState = buildWizardCategoryState; exports.buildWizardTreeState = buildWizardTreeState; exports.composeWizardProviders = composeWizardProviders; exports.scrollToStep = scrollToStep; exports.useWizard = _chunkXNH2LQZLcjs.useWizard; exports.useWizardCategoriesView = useWizardCategoriesView; exports.useWizardComponents = _chunkXNH2LQZLcjs.useWizardComponents; exports.useWizardEngineRef = useWizardEngineRef; exports.useWizardEvent = useWizardEvent; exports.useWizardStep = useWizardStep; exports.withConfig = withConfig; exports.withInitializer = withInitializer; exports.withListener = withListener; exports.withProgressStrategy = withProgressStrategy; exports.withScrollContainer = withScrollContainer; exports.withScrollStrategy = withScrollStrategy; exports.withVisibilityStrategy = withVisibilityStrategy; exports.wizardDefaultBranch = wizardDefaultBranch; exports.wizardDefaultConfig = wizardDefaultConfig; exports.wizardDefaultState = wizardDefaultState; exports.wizardRules = wizardRules;
2349
2189
  //# sourceMappingURL=index.cjs.map