@flowsterix/react 0.10.1 → 0.11.1

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.
Files changed (62) hide show
  1. package/dist/chunk-AJZMUYBN.mjs +21 -0
  2. package/dist/chunk-D5LQLRSU.cjs +289 -0
  3. package/dist/chunk-FCOKCGV3.cjs +21 -0
  4. package/dist/chunk-HPVLOLCD.cjs +1 -0
  5. package/dist/components/TourPopoverPortal.d.ts +1 -1
  6. package/dist/components/TourPopoverPortal.d.ts.map +1 -1
  7. package/dist/context.d.ts +6 -0
  8. package/dist/context.d.ts.map +1 -1
  9. package/dist/devtools/DevToolsContext.d.ts +31 -0
  10. package/dist/devtools/DevToolsContext.d.ts.map +1 -0
  11. package/dist/devtools/DevToolsProvider.d.ts +9 -0
  12. package/dist/devtools/DevToolsProvider.d.ts.map +1 -0
  13. package/dist/devtools/components/FlowEditModal.d.ts +11 -0
  14. package/dist/devtools/components/FlowEditModal.d.ts.map +1 -0
  15. package/dist/devtools/components/FlowItem.d.ts +8 -0
  16. package/dist/devtools/components/FlowItem.d.ts.map +1 -0
  17. package/dist/devtools/components/FlowsTab.d.ts +5 -0
  18. package/dist/devtools/components/FlowsTab.d.ts.map +1 -0
  19. package/dist/devtools/components/GrabberOverlay.d.ts +8 -0
  20. package/dist/devtools/components/GrabberOverlay.d.ts.map +1 -0
  21. package/dist/devtools/components/ShadowRoot.d.ts +7 -0
  22. package/dist/devtools/components/ShadowRoot.d.ts.map +1 -0
  23. package/dist/devtools/components/StepItem.d.ts +16 -0
  24. package/dist/devtools/components/StepItem.d.ts.map +1 -0
  25. package/dist/devtools/components/StepList.d.ts +17 -0
  26. package/dist/devtools/components/StepList.d.ts.map +1 -0
  27. package/dist/devtools/components/TabNav.d.ts +9 -0
  28. package/dist/devtools/components/TabNav.d.ts.map +1 -0
  29. package/dist/devtools/components/Toolbar.d.ts +11 -0
  30. package/dist/devtools/components/Toolbar.d.ts.map +1 -0
  31. package/dist/devtools/globalBridge.d.ts +24 -0
  32. package/dist/devtools/globalBridge.d.ts.map +1 -0
  33. package/dist/devtools/hooks/useElementInfo.d.ts +7 -0
  34. package/dist/devtools/hooks/useElementInfo.d.ts.map +1 -0
  35. package/dist/devtools/hooks/useFlowsData.d.ts +16 -0
  36. package/dist/devtools/hooks/useFlowsData.d.ts.map +1 -0
  37. package/dist/devtools/hooks/useGrabMode.d.ts +16 -0
  38. package/dist/devtools/hooks/useGrabMode.d.ts.map +1 -0
  39. package/dist/devtools/hooks/useStepStore.d.ts +22 -0
  40. package/dist/devtools/hooks/useStepStore.d.ts.map +1 -0
  41. package/dist/devtools/index.cjs +2715 -0
  42. package/dist/devtools/index.d.ts +32 -0
  43. package/dist/devtools/index.d.ts.map +1 -0
  44. package/dist/devtools/index.mjs +2715 -0
  45. package/dist/devtools/types.d.ts +66 -0
  46. package/dist/devtools/types.d.ts.map +1 -0
  47. package/dist/devtools/utils/selectorGenerator.d.ts +11 -0
  48. package/dist/devtools/utils/selectorGenerator.d.ts.map +1 -0
  49. package/dist/devtools/utils/sourceExtractor.d.ts +45 -0
  50. package/dist/devtools/utils/sourceExtractor.d.ts.map +1 -0
  51. package/dist/devtools/utils/storage.d.ts +5 -0
  52. package/dist/devtools/utils/storage.d.ts.map +1 -0
  53. package/dist/hooks/useHiddenTargetFallback.d.ts.map +1 -1
  54. package/dist/hooks/useTourOverlay.d.ts.map +1 -1
  55. package/dist/index.cjs +724 -892
  56. package/dist/index.mjs +145 -16
  57. package/dist/router/index.cjs +13 -202
  58. package/dist/router/nextAppRouterAdapter.cjs +11 -200
  59. package/dist/router/nextPagesRouterAdapter.cjs +10 -199
  60. package/dist/router/reactRouterAdapter.cjs +10 -199
  61. package/dist/router/tanstackRouterAdapter.cjs +22 -214
  62. package/package.json +10 -1
package/dist/index.cjs CHANGED
@@ -1,73 +1,44 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.tsx
21
- var index_exports = {};
22
- __export(index_exports, {
23
- AnimationAdapterProvider: () => AnimationAdapterProvider,
24
- DialogRegistryProvider: () => DialogRegistryProvider,
25
- OverlayBackdrop: () => OverlayBackdrop,
26
- TourFocusManager: () => TourFocusManager,
27
- TourPopoverPortal: () => TourPopoverPortal,
28
- TourProvider: () => TourProvider,
29
- createPathString: () => createPathString,
30
- createWaitForPredicateController: () => createWaitForPredicateController,
31
- defaultAnimationAdapter: () => defaultAnimationAdapter,
32
- defaultLabels: () => defaultLabels,
33
- getCurrentRoutePath: () => getCurrentRoutePath,
34
- notifyRouteChange: () => notifyRouteChange,
35
- reducedMotionAnimationAdapter: () => reducedMotionAnimationAdapter,
36
- subscribeToRouteChanges: () => subscribeToRouteChanges,
37
- useAdvanceRules: () => useAdvanceRules,
38
- useAnimationAdapter: () => useAnimationAdapter,
39
- useBodyScrollLock: () => useBodyScrollLock,
40
- useDelayAdvance: () => useDelayAdvance,
41
- useDialogRegistry: () => useDialogRegistry,
42
- useDialogRegistryOptional: () => useDialogRegistryOptional,
43
- useHiddenTargetFallback: () => useHiddenTargetFallback,
44
- useHudDescription: () => useHudDescription,
45
- useHudMotion: () => useHudMotion,
46
- useHudShortcuts: () => useHudShortcuts,
47
- useHudState: () => useHudState,
48
- useHudTargetIssue: () => useHudTargetIssue,
49
- usePreferredAnimationAdapter: () => usePreferredAnimationAdapter,
50
- useRadixDialogAdapter: () => useRadixDialogAdapter,
51
- useRadixTourDialog: () => useRadixTourDialog,
52
- useTour: () => useTour,
53
- useTourControls: () => useTourControls,
54
- useTourEvents: () => useTourEvents,
55
- useTourFocusDominance: () => useTourFocusDominance,
56
- useTourHud: () => useTourHud,
57
- useTourLabels: () => useTourLabels,
58
- useTourOverlay: () => useTourOverlay,
59
- useTourTarget: () => useTourTarget,
60
- useViewportRect: () => useViewportRect,
61
- waitForDom: () => waitForDom
62
- });
63
- module.exports = __toCommonJS(index_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; }
2
+
3
+ var _chunkFCOKCGV3cjs = require('./chunk-FCOKCGV3.cjs');
4
+ require('./chunk-HPVLOLCD.cjs');
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+ var _chunkD5LQLRSUcjs = require('./chunk-D5LQLRSU.cjs');
64
19
 
65
20
  // src/context.tsx
66
- var import_core = require("@flowsterix/core");
67
- var import_react6 = require("react");
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ var _core = require('@flowsterix/core');
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+ var _react = require('react');
68
39
 
69
40
  // src/labels.ts
70
- var import_react = require("react");
41
+
71
42
  var defaultLabels = {
72
43
  back: "Back",
73
44
  next: "Next",
@@ -89,34 +60,40 @@ var defaultLabels = {
89
60
  detachedBody: "Navigate back to the screen that contains this element or reopen it before continuing the tour."
90
61
  }
91
62
  };
92
- var LabelsContext = (0, import_react.createContext)(defaultLabels);
63
+ var LabelsContext = _react.createContext.call(void 0, defaultLabels);
93
64
  var LabelsProvider = LabelsContext.Provider;
94
65
  function useTourLabels() {
95
- return (0, import_react.useContext)(LabelsContext);
66
+ return _react.useContext.call(void 0, LabelsContext);
96
67
  }
97
68
 
98
69
  // src/dialog/DialogRegistryContext.tsx
99
- var import_react2 = require("react");
100
- var import_jsx_runtime = require("react/jsx-runtime");
101
- var DialogRegistryContext = (0, import_react2.createContext)(void 0);
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ var _jsxruntime = require('react/jsx-runtime');
78
+ var DialogRegistryContext = _react.createContext.call(void 0, void 0);
102
79
  var DialogRegistryProvider = ({ children }) => {
103
- const controllersRef = (0, import_react2.useRef)(/* @__PURE__ */ new Map());
104
- const register = (0, import_react2.useCallback)(
80
+ const controllersRef = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
81
+ const register = _react.useCallback.call(void 0,
105
82
  (dialogId, controller) => {
106
83
  controllersRef.current.set(dialogId, controller);
107
84
  },
108
85
  []
109
86
  );
110
- const unregister = (0, import_react2.useCallback)((dialogId) => {
87
+ const unregister = _react.useCallback.call(void 0, (dialogId) => {
111
88
  controllersRef.current.delete(dialogId);
112
89
  }, []);
113
- const getController = (0, import_react2.useCallback)((dialogId) => {
90
+ const getController = _react.useCallback.call(void 0, (dialogId) => {
114
91
  return controllersRef.current.get(dialogId);
115
92
  }, []);
116
- const isRegistered = (0, import_react2.useCallback)((dialogId) => {
93
+ const isRegistered = _react.useCallback.call(void 0, (dialogId) => {
117
94
  return controllersRef.current.has(dialogId);
118
95
  }, []);
119
- const value = (0, import_react2.useMemo)(
96
+ const value = _react.useMemo.call(void 0,
120
97
  () => ({
121
98
  register,
122
99
  unregister,
@@ -125,10 +102,10 @@ var DialogRegistryProvider = ({ children }) => {
125
102
  }),
126
103
  [register, unregister, getController, isRegistered]
127
104
  );
128
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogRegistryContext.Provider, { value, children });
105
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogRegistryContext.Provider, { value, children });
129
106
  };
130
107
  var useDialogRegistry = () => {
131
- const context = (0, import_react2.useContext)(DialogRegistryContext);
108
+ const context = _react.useContext.call(void 0, DialogRegistryContext);
132
109
  if (!context) {
133
110
  throw new Error(
134
111
  "useDialogRegistry must be used within a DialogRegistryProvider"
@@ -137,11 +114,11 @@ var useDialogRegistry = () => {
137
114
  return context;
138
115
  };
139
116
  var useDialogRegistryOptional = () => {
140
- return (0, import_react2.useContext)(DialogRegistryContext);
117
+ return _react.useContext.call(void 0, DialogRegistryContext);
141
118
  };
142
119
 
143
120
  // src/hooks/useDialogAutomation.ts
144
- var import_react3 = require("react");
121
+
145
122
  var resolveAutoOpen = (config) => {
146
123
  if (!config) return { onEnter: true, onResume: true };
147
124
  const { autoOpen } = config;
@@ -150,22 +127,22 @@ var resolveAutoOpen = (config) => {
150
127
  return { onEnter: true, onResume: true };
151
128
  }
152
129
  return {
153
- onEnter: autoOpen.onEnter ?? true,
154
- onResume: autoOpen.onResume ?? true
130
+ onEnter: _nullishCoalesce(autoOpen.onEnter, () => ( true)),
131
+ onResume: _nullishCoalesce(autoOpen.onResume, () => ( true))
155
132
  };
156
133
  };
157
134
  var useDialogAutomation = (params) => {
158
135
  const { flow, state, events, registry, onDialogNotMounted } = params;
159
- const previousDialogIdRef = (0, import_react3.useRef)(void 0);
160
- (0, import_react3.useEffect)(() => {
136
+ const previousDialogIdRef = _react.useRef.call(void 0, void 0);
137
+ _react.useEffect.call(void 0, () => {
161
138
  if (!events || !flow || !registry) return;
162
139
  const unsubscribeEnter = events.on("stepEnter", (payload) => {
163
140
  const step = payload.currentStep;
164
141
  const dialogId = step.dialogId;
165
142
  const previousDialogId = previousDialogIdRef.current;
166
- if (previousDialogId && previousDialogId !== dialogId && flow.dialogs?.[previousDialogId]) {
143
+ if (previousDialogId && previousDialogId !== dialogId && _optionalChain([flow, 'access', _ => _.dialogs, 'optionalAccess', _2 => _2[previousDialogId]])) {
167
144
  const config = flow.dialogs[previousDialogId];
168
- const autoClose = config.autoClose ?? "differentDialog";
145
+ const autoClose = _nullishCoalesce(config.autoClose, () => ( "differentDialog"));
169
146
  if (autoClose === "always" || autoClose === "differentDialog") {
170
147
  const controller = registry.getController(previousDialogId);
171
148
  if (controller) {
@@ -175,7 +152,7 @@ var useDialogAutomation = (params) => {
175
152
  }
176
153
  }
177
154
  }
178
- if (dialogId && flow.dialogs?.[dialogId]) {
155
+ if (dialogId && _optionalChain([flow, 'access', _3 => _3.dialogs, 'optionalAccess', _4 => _4[dialogId]])) {
179
156
  const config = flow.dialogs[dialogId];
180
157
  const autoOpenConfig = resolveAutoOpen(config);
181
158
  const isResume = payload.reason === "resume";
@@ -197,10 +174,10 @@ var useDialogAutomation = (params) => {
197
174
  const step = payload.previousStep;
198
175
  const dialogId = step.dialogId;
199
176
  const nextStep = payload.currentStep;
200
- if (nextStep?.dialogId === dialogId) return;
201
- if (dialogId && flow.dialogs?.[dialogId]) {
177
+ if (_optionalChain([nextStep, 'optionalAccess', _5 => _5.dialogId]) === dialogId) return;
178
+ if (dialogId && _optionalChain([flow, 'access', _6 => _6.dialogs, 'optionalAccess', _7 => _7[dialogId]])) {
202
179
  const config = flow.dialogs[dialogId];
203
- const autoClose = config.autoClose ?? "differentDialog";
180
+ const autoClose = _nullishCoalesce(config.autoClose, () => ( "differentDialog"));
204
181
  if (autoClose === "never") return;
205
182
  const controller = registry.getController(dialogId);
206
183
  if (controller) {
@@ -212,12 +189,12 @@ var useDialogAutomation = (params) => {
212
189
  });
213
190
  const handleFlowEnd = () => {
214
191
  const dialogId = previousDialogIdRef.current;
215
- if (dialogId && flow.dialogs?.[dialogId]) {
192
+ if (dialogId && _optionalChain([flow, 'access', _8 => _8.dialogs, 'optionalAccess', _9 => _9[dialogId]])) {
216
193
  const config = flow.dialogs[dialogId];
217
- const autoClose = config.autoClose ?? "differentDialog";
194
+ const autoClose = _nullishCoalesce(config.autoClose, () => ( "differentDialog"));
218
195
  if (autoClose !== "never") {
219
196
  const controller = registry.getController(dialogId);
220
- controller?.close();
197
+ _optionalChain([controller, 'optionalAccess', _10 => _10.close, 'call', _11 => _11()]);
221
198
  }
222
199
  }
223
200
  previousDialogIdRef.current = void 0;
@@ -233,7 +210,7 @@ var useDialogAutomation = (params) => {
233
210
  unsubscribeComplete();
234
211
  };
235
212
  }, [events, flow, registry, onDialogNotMounted]);
236
- (0, import_react3.useEffect)(() => {
213
+ _react.useEffect.call(void 0, () => {
237
214
  if (!flow || !state || state.status !== "running") return;
238
215
  if (state.stepIndex < 0 || state.stepIndex >= flow.steps.length) return;
239
216
  const currentStep = flow.steps[state.stepIndex];
@@ -242,19 +219,19 @@ var useDialogAutomation = (params) => {
242
219
  };
243
220
 
244
221
  // src/motion/animationAdapter.tsx
245
- var import_react4 = require("motion/react");
246
- var import_react5 = require("react");
247
- var import_jsx_runtime2 = require("react/jsx-runtime");
222
+ var _react3 = require('motion/react');
223
+
224
+
248
225
  var defaultAdapter = {
249
226
  components: {
250
- MotionDiv: import_react4.motion.div,
251
- MotionSection: import_react4.motion.section,
252
- MotionSvg: import_react4.motion.svg,
253
- MotionDefs: import_react4.motion.defs,
254
- MotionMask: import_react4.motion.mask,
255
- MotionRect: import_react4.motion.rect,
256
- MotionSpan: import_react4.motion.span,
257
- MotionButton: import_react4.motion.button
227
+ MotionDiv: _react3.motion.div,
228
+ MotionSection: _react3.motion.section,
229
+ MotionSvg: _react3.motion.svg,
230
+ MotionDefs: _react3.motion.defs,
231
+ MotionMask: _react3.motion.mask,
232
+ MotionRect: _react3.motion.rect,
233
+ MotionSpan: _react3.motion.span,
234
+ MotionButton: _react3.motion.button
258
235
  },
259
236
  transitions: {
260
237
  overlayHighlight: {
@@ -287,16 +264,16 @@ var defaultAdapter = {
287
264
  }
288
265
  }
289
266
  };
290
- var AnimationAdapterContext = (0, import_react5.createContext)(defaultAdapter);
267
+ var AnimationAdapterContext = _react.createContext.call(void 0, defaultAdapter);
291
268
  var AnimationAdapterProvider = ({
292
269
  adapter,
293
270
  children
294
271
  }) => {
295
- const value = (0, import_react5.useMemo)(() => adapter ?? defaultAdapter, [adapter]);
296
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AnimationAdapterContext.Provider, { value, children });
272
+ const value = _react.useMemo.call(void 0, () => _nullishCoalesce(adapter, () => ( defaultAdapter)), [adapter]);
273
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnimationAdapterContext.Provider, { value, children });
297
274
  };
298
275
  var useAnimationAdapter = () => {
299
- return (0, import_react5.useContext)(AnimationAdapterContext);
276
+ return _react.useContext.call(void 0, AnimationAdapterContext);
300
277
  };
301
278
  var defaultAnimationAdapter = defaultAdapter;
302
279
  var reducedMotionAnimationAdapter = {
@@ -335,12 +312,12 @@ var usePreferredAnimationAdapter = (options) => {
335
312
  defaultAdapter: defaultOption = defaultAnimationAdapter,
336
313
  reducedMotionAdapter: reducedOption = reducedMotionAnimationAdapter,
337
314
  enabled = true
338
- } = options ?? {};
339
- const [prefersReduced, setPrefersReduced] = (0, import_react5.useState)(() => {
315
+ } = _nullishCoalesce(options, () => ( {}));
316
+ const [prefersReduced, setPrefersReduced] = _react.useState.call(void 0, () => {
340
317
  if (!enabled || typeof window === "undefined") return false;
341
318
  return window.matchMedia(REDUCED_MOTION_QUERY).matches;
342
319
  });
343
- (0, import_react5.useEffect)(() => {
320
+ _react.useEffect.call(void 0, () => {
344
321
  if (!enabled || typeof window === "undefined") return;
345
322
  const mediaQuery = window.matchMedia(REDUCED_MOTION_QUERY);
346
323
  const handleChange = (event) => {
@@ -356,243 +333,13 @@ var usePreferredAnimationAdapter = (options) => {
356
333
  return prefersReduced ? reducedOption : defaultOption;
357
334
  };
358
335
 
359
- // src/utils/dom.ts
360
- var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
361
- var createRect = ({
362
- top,
363
- left,
364
- width,
365
- height
366
- }) => ({
367
- top,
368
- left,
369
- width,
370
- height,
371
- right: left + width,
372
- bottom: top + height
373
- });
374
- var toClientRect = (rect) => createRect({
375
- top: rect.top,
376
- left: rect.left,
377
- width: rect.width,
378
- height: rect.height
379
- });
380
- var getViewportRect = () => {
381
- if (!isBrowser) {
382
- return createRect({ top: 0, left: 0, width: 0, height: 0 });
383
- }
384
- const clientWidth = document.documentElement.clientWidth;
385
- const clientHeight = document.documentElement.clientHeight;
386
- const width = clientWidth > 0 ? clientWidth : window.innerWidth;
387
- const height = clientHeight > 0 ? clientHeight : window.innerHeight;
388
- return createRect({
389
- top: 0,
390
- left: 0,
391
- width,
392
- height
393
- });
394
- };
395
- var expandRect = (rect, padding) => {
396
- if (!isBrowser) return rect;
397
- const viewport = getViewportRect();
398
- const spaceTop = rect.top;
399
- const spaceBottom = viewport.height - rect.bottom;
400
- const spaceLeft = rect.left;
401
- const spaceRight = viewport.width - rect.right;
402
- const verticalPadding = Math.min(padding, spaceTop, spaceBottom);
403
- const horizontalPadding = Math.min(padding, spaceLeft, spaceRight);
404
- return createRect({
405
- top: rect.top - verticalPadding,
406
- left: rect.left - horizontalPadding,
407
- width: rect.width + horizontalPadding * 2,
408
- height: rect.height + verticalPadding * 2
409
- });
410
- };
411
- var getClientRect = (element) => toClientRect(element.getBoundingClientRect());
412
- var SCROLLABLE_OVERFLOW = /(auto|scroll|overlay)/i;
413
- var isElementScrollable = (node) => {
414
- if (!isBrowser) return false;
415
- const style = window.getComputedStyle(node);
416
- if (style.position === "fixed") return false;
417
- return SCROLLABLE_OVERFLOW.test(style.overflow) || SCROLLABLE_OVERFLOW.test(style.overflowX) || SCROLLABLE_OVERFLOW.test(style.overflowY);
418
- };
419
- var getScrollParents = (element) => {
420
- if (!isBrowser) return [];
421
- const parents = [];
422
- const seen = /* @__PURE__ */ new Set();
423
- let current = element.parentElement;
424
- while (current && current !== document.documentElement) {
425
- if (current !== document.body && isElementScrollable(current)) {
426
- if (!seen.has(current)) {
427
- parents.push(current);
428
- seen.add(current);
429
- }
430
- }
431
- current = current.parentElement;
432
- }
433
- const scrollingElement = document.scrollingElement;
434
- if (scrollingElement && scrollingElement instanceof Element && !seen.has(scrollingElement) && isElementScrollable(scrollingElement)) {
435
- parents.push(scrollingElement);
436
- seen.add(scrollingElement);
437
- }
438
- return parents;
439
- };
440
- var portalHost = () => isBrowser ? document.body : null;
441
- var cachedMaskSupport = null;
442
- var detectMaskSupport = () => {
443
- if (!isBrowser) return false;
444
- if ("CSS" in window) {
445
- try {
446
- if (window.CSS.supports("mask-image", "linear-gradient(#000,#000)")) {
447
- return true;
448
- }
449
- if (window.CSS.supports("-webkit-mask-image", "linear-gradient(#000,#000)")) {
450
- return true;
451
- }
452
- } catch (error) {
453
- if (typeof console !== "undefined") {
454
- console.warn("Flowsterix: CSS.supports check failed", error);
455
- }
456
- }
457
- }
458
- const probe = document.createElement("div");
459
- return "maskImage" in probe.style || "webkitMaskImage" in probe.style;
460
- };
461
- var supportsMasking = () => {
462
- if (!isBrowser) return false;
463
- if (cachedMaskSupport === null) {
464
- cachedMaskSupport = detectMaskSupport();
465
- }
466
- return cachedMaskSupport;
467
- };
468
-
469
- // src/router/routeGating.ts
470
- var DEFAULT_POLL_MS = 150;
471
- var normalizePathname = (pathname) => {
472
- if (typeof pathname !== "string" || pathname.length === 0) {
473
- return "/";
474
- }
475
- return pathname.startsWith("/") ? pathname : `/${pathname}`;
476
- };
477
- var normalizePrefixedSegment = (value, prefix) => {
478
- if (typeof value !== "string" || value.length === 0) {
479
- return "";
480
- }
481
- return value.startsWith(prefix) ? value : `${prefix}${value}`;
482
- };
483
- var getWindowPath = () => {
484
- if (!isBrowser) return "/";
485
- const { pathname, search, hash } = window.location;
486
- return normalizePathname(pathname) + normalizePrefixedSegment(search, "?") + normalizePrefixedSegment(hash, "#");
487
- };
488
- var normalizeExternalPath = (path) => {
489
- if (path.length === 0) {
490
- return "/";
491
- }
492
- try {
493
- const parsed = new URL(path, "http://flowsterix.local");
494
- return normalizePathname(parsed.pathname) + normalizePrefixedSegment(parsed.search, "?") + normalizePrefixedSegment(parsed.hash, "#");
495
- } catch {
496
- const [withoutHash, hash = ""] = path.split("#");
497
- const [base, search = ""] = withoutHash.split("?");
498
- return normalizePathname(base) + normalizePrefixedSegment(search ? `?${search}` : "", "?") + normalizePrefixedSegment(hash ? `#${hash}` : "", "#");
499
- }
500
- };
501
- var RouteGatingChannel = class {
502
- #listeners = /* @__PURE__ */ new Set();
503
- #currentPath = getWindowPath();
504
- #teardown = null;
505
- #attachDefaultListeners() {
506
- if (!isBrowser) return;
507
- if (this.#teardown) return;
508
- let lastPath = getWindowPath();
509
- const emitIfChanged = () => {
510
- const nextPath = getWindowPath();
511
- if (nextPath === lastPath) return;
512
- lastPath = nextPath;
513
- this.notify(nextPath);
514
- };
515
- const handler = () => emitIfChanged();
516
- window.addEventListener("popstate", handler);
517
- window.addEventListener("hashchange", handler);
518
- const pollId = window.setInterval(emitIfChanged, DEFAULT_POLL_MS);
519
- this.#teardown = () => {
520
- window.removeEventListener("popstate", handler);
521
- window.removeEventListener("hashchange", handler);
522
- window.clearInterval(pollId);
523
- this.#teardown = null;
524
- };
525
- }
526
- #detachDefaultListeners() {
527
- if (this.#listeners.size > 0) return;
528
- this.#teardown?.();
529
- this.#teardown = null;
530
- }
531
- getCurrentPath() {
532
- if (isBrowser) {
533
- this.#currentPath = getWindowPath();
534
- }
535
- return this.#currentPath;
536
- }
537
- notify(path) {
538
- const resolved = typeof path === "string" && path.length > 0 ? normalizeExternalPath(path) : this.getCurrentPath();
539
- if (resolved === this.#currentPath) {
540
- this.#currentPath = resolved;
541
- return;
542
- }
543
- this.#currentPath = resolved;
544
- for (const listener of Array.from(this.#listeners)) {
545
- try {
546
- listener(resolved);
547
- } catch (error) {
548
- console.warn("[tour][route-gating] listener error", error);
549
- }
550
- }
551
- }
552
- subscribe(listener) {
553
- if (this.#listeners.has(listener)) {
554
- return () => {
555
- this.#listeners.delete(listener);
556
- this.#detachDefaultListeners();
557
- };
558
- }
559
- this.#listeners.add(listener);
560
- if (this.#listeners.size === 1) {
561
- this.#attachDefaultListeners();
562
- }
563
- const current = this.getCurrentPath();
564
- try {
565
- listener(current);
566
- } catch (error) {
567
- console.warn("[tour][route-gating] listener error", error);
568
- }
569
- return () => {
570
- this.#listeners.delete(listener);
571
- this.#detachDefaultListeners();
572
- };
573
- }
574
- };
575
- var routeGatingChannel = new RouteGatingChannel();
576
- var getCurrentRoutePath = () => routeGatingChannel.getCurrentPath();
577
- var notifyRouteChange = (path) => {
578
- routeGatingChannel.notify(path);
579
- };
580
- var subscribeToRouteChanges = (listener) => {
581
- return routeGatingChannel.subscribe(listener);
582
- };
583
- var matchRoute = (params) => {
584
- const { pattern, path } = params;
585
- if (!pattern) return true;
586
- if (typeof pattern === "string") return path === pattern;
587
- return pattern.test(path);
588
- };
589
-
590
336
  // src/context.tsx
591
- var import_jsx_runtime3 = require("react/jsx-runtime");
592
- var TourContext = (0, import_react6.createContext)(void 0);
337
+
338
+ var DEVTOOLS_BRIDGE_KEY = "__FLOWSTERIX_DEVTOOLS_BRIDGE__";
339
+ var TourContext = _react.createContext.call(void 0, void 0);
593
340
  var DEFAULT_STORAGE_PREFIX = "tour";
594
341
  var useFlowMap = (flows) => {
595
- return (0, import_react6.useMemo)(() => {
342
+ return _react.useMemo.call(void 0, () => {
596
343
  const map = /* @__PURE__ */ new Map();
597
344
  for (const flow of flows) {
598
345
  map.set(flow.id, flow);
@@ -616,35 +363,35 @@ var TourProvider = ({
616
363
  labels: labelsProp,
617
364
  onVersionMismatch
618
365
  }) => {
619
- const mergedLabels = (0, import_react6.useMemo)(
366
+ const mergedLabels = _react.useMemo.call(void 0,
620
367
  () => ({ ...defaultLabels, ...labelsProp }),
621
368
  [labelsProp]
622
369
  );
623
370
  const flowMap = useFlowMap(flows);
624
- const storeRef = (0, import_react6.useRef)(null);
625
- const unsubscribeRef = (0, import_react6.useRef)(null);
626
- const stepHooksUnsubscribeRef = (0, import_react6.useRef)(null);
627
- const fallbackStorageRef = (0, import_react6.useRef)(void 0);
628
- const pendingResumeRef = (0, import_react6.useRef)(/* @__PURE__ */ new Set());
629
- const autoStartRequestedRef = (0, import_react6.useRef)(null);
630
- const [activeFlowId, setActiveFlowId] = (0, import_react6.useState)(null);
631
- const [state, setState] = (0, import_react6.useState)(null);
632
- const [events, setEvents] = (0, import_react6.useState)(
371
+ const storeRef = _react.useRef.call(void 0, null);
372
+ const unsubscribeRef = _react.useRef.call(void 0, null);
373
+ const stepHooksUnsubscribeRef = _react.useRef.call(void 0, null);
374
+ const fallbackStorageRef = _react.useRef.call(void 0, void 0);
375
+ const pendingResumeRef = _react.useRef.call(void 0, /* @__PURE__ */ new Set());
376
+ const autoStartRequestedRef = _react.useRef.call(void 0, null);
377
+ const [activeFlowId, setActiveFlowId] = _react.useState.call(void 0, null);
378
+ const [state, setState] = _react.useState.call(void 0, null);
379
+ const [events, setEvents] = _react.useState.call(void 0,
633
380
  null
634
381
  );
635
- const [debugEnabled, setDebugEnabled] = (0, import_react6.useState)(defaultDebug);
636
- const [delayInfo, setDelayInfo] = (0, import_react6.useState)(null);
637
- const teardownStore = (0, import_react6.useCallback)(() => {
638
- unsubscribeRef.current?.();
382
+ const [debugEnabled, setDebugEnabled] = _react.useState.call(void 0, defaultDebug);
383
+ const [delayInfo, setDelayInfo] = _react.useState.call(void 0, null);
384
+ const teardownStore = _react.useCallback.call(void 0, () => {
385
+ _optionalChain([unsubscribeRef, 'access', _12 => _12.current, 'optionalCall', _13 => _13()]);
639
386
  unsubscribeRef.current = null;
640
- stepHooksUnsubscribeRef.current?.();
387
+ _optionalChain([stepHooksUnsubscribeRef, 'access', _14 => _14.current, 'optionalCall', _15 => _15()]);
641
388
  stepHooksUnsubscribeRef.current = null;
642
- storeRef.current?.destroy();
389
+ _optionalChain([storeRef, 'access', _16 => _16.current, 'optionalAccess', _17 => _17.destroy, 'call', _18 => _18()]);
643
390
  storeRef.current = null;
644
391
  setDelayInfo(null);
645
392
  pendingResumeRef.current.clear();
646
393
  }, []);
647
- (0, import_react6.useEffect)(() => {
394
+ _react.useEffect.call(void 0, () => {
648
395
  return () => {
649
396
  teardownStore();
650
397
  setState(null);
@@ -652,7 +399,7 @@ var TourProvider = ({
652
399
  setActiveFlowId(null);
653
400
  };
654
401
  }, [teardownStore]);
655
- (0, import_react6.useEffect)(() => {
402
+ _react.useEffect.call(void 0, () => {
656
403
  if (!activeFlowId) return;
657
404
  const definition = flowMap.get(activeFlowId);
658
405
  if (!definition) {
@@ -675,7 +422,7 @@ var TourProvider = ({
675
422
  console.warn(`[tour][step] ${phase} hook failed`, error);
676
423
  }
677
424
  };
678
- const ensureStore = (0, import_react6.useCallback)(
425
+ const ensureStore = _react.useCallback.call(void 0,
679
426
  (flowId) => {
680
427
  const existing = storeRef.current;
681
428
  if (existing && existing.definition.id === flowId) {
@@ -686,12 +433,12 @@ var TourProvider = ({
686
433
  if (!definition) {
687
434
  throw new Error(`Flow with id "${flowId}" is not registered.`);
688
435
  }
689
- if (!storageAdapter && !fallbackStorageRef.current && isBrowser) {
690
- fallbackStorageRef.current = (0, import_core.createLocalStorageAdapter)();
436
+ if (!storageAdapter && !fallbackStorageRef.current && _chunkD5LQLRSUcjs.isBrowser) {
437
+ fallbackStorageRef.current = _core.createLocalStorageAdapter.call(void 0, );
691
438
  }
692
- const resolvedStorageAdapter = storageAdapter ? storageAdapter : fallbackStorageRef.current;
693
- const store = (0, import_core.createFlowStore)(definition, {
694
- storageAdapter: resolvedStorageAdapter,
439
+ const resolvedStorageAdapter2 = storageAdapter ? storageAdapter : fallbackStorageRef.current;
440
+ const store = _core.createFlowStore.call(void 0, definition, {
441
+ storageAdapter: resolvedStorageAdapter2,
695
442
  storageKey: storageNamespace ? `${storageNamespace}:${definition.id}` : void 0,
696
443
  persistOnChange,
697
444
  analytics,
@@ -734,7 +481,7 @@ var TourProvider = ({
734
481
  teardownStore
735
482
  ]
736
483
  );
737
- const getActiveStore = (0, import_react6.useCallback)(() => {
484
+ const getActiveStore = _react.useCallback.call(void 0, () => {
738
485
  const store = storeRef.current;
739
486
  if (!store) {
740
487
  throw new Error(
@@ -746,7 +493,7 @@ var TourProvider = ({
746
493
  const isPromiseLike2 = (value) => {
747
494
  return typeof value === "object" && value !== null && typeof value.then === "function";
748
495
  };
749
- const invokeStepHook = (0, import_react6.useCallback)(
496
+ const invokeStepHook = _react.useCallback.call(void 0,
750
497
  async (hook, context, phase) => {
751
498
  if (!hook) return;
752
499
  try {
@@ -760,7 +507,7 @@ var TourProvider = ({
760
507
  },
761
508
  []
762
509
  );
763
- const runResumeHooks = (0, import_react6.useCallback)(
510
+ const runResumeHooks = _react.useCallback.call(void 0,
764
511
  async (definition, flowState, strategy) => {
765
512
  if (flowState.status !== "running") return;
766
513
  if (strategy === "current") {
@@ -800,25 +547,25 @@ var TourProvider = ({
800
547
  },
801
548
  [invokeStepHook]
802
549
  );
803
- const resolveResumeStrategy = (0, import_react6.useCallback)(
550
+ const resolveResumeStrategy = _react.useCallback.call(void 0,
804
551
  (definition, options) => {
805
- return options?.resumeStrategy ?? definition.resumeStrategy ?? "chain";
552
+ return _nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _19 => _19.resumeStrategy]), () => ( definition.resumeStrategy)), () => ( "chain"));
806
553
  },
807
554
  []
808
555
  );
809
- const startFlow = (0, import_react6.useCallback)(
556
+ const startFlow = _react.useCallback.call(void 0,
810
557
  (flowId, options) => {
811
558
  const store = ensureStore(flowId);
812
559
  const previousState = store.getState();
813
560
  setActiveFlowId(flowId);
814
- if (options?.resume) {
561
+ if (_optionalChain([options, 'optionalAccess', _20 => _20.resume])) {
815
562
  pendingResumeRef.current.add(flowId);
816
563
  } else {
817
564
  pendingResumeRef.current.delete(flowId);
818
565
  }
819
566
  const result = store.start(options);
820
567
  const nextState = store.getState();
821
- if (!options?.resume) {
568
+ if (!_optionalChain([options, 'optionalAccess', _21 => _21.resume])) {
822
569
  return result;
823
570
  }
824
571
  if (previousState.stepIndex >= 0 && nextState.status === "running") {
@@ -835,18 +582,18 @@ var TourProvider = ({
835
582
  },
836
583
  [ensureStore, resolveResumeStrategy, runResumeHooks]
837
584
  );
838
- const [eligibleFlows, setEligibleFlows] = (0, import_react6.useState)([]);
839
- (0, import_react6.useEffect)(() => {
585
+ const [eligibleFlows, setEligibleFlows] = _react.useState.call(void 0, []);
586
+ _react.useEffect.call(void 0, () => {
840
587
  const autoStartFlows = flows.filter((f) => f.autoStart);
841
588
  if (autoStartFlows.length === 0) {
842
589
  setEligibleFlows([]);
843
590
  return;
844
591
  }
845
- if (!storageAdapter && !fallbackStorageRef.current && isBrowser) {
846
- fallbackStorageRef.current = (0, import_core.createLocalStorageAdapter)();
592
+ if (!storageAdapter && !fallbackStorageRef.current && _chunkD5LQLRSUcjs.isBrowser) {
593
+ fallbackStorageRef.current = _core.createLocalStorageAdapter.call(void 0, );
847
594
  }
848
- const resolvedStorageAdapter = storageAdapter ?? fallbackStorageRef.current;
849
- if (!resolvedStorageAdapter) {
595
+ const resolvedStorageAdapter2 = _nullishCoalesce(storageAdapter, () => ( fallbackStorageRef.current));
596
+ if (!resolvedStorageAdapter2) {
850
597
  setEligibleFlows(
851
598
  autoStartFlows.map((flow) => ({
852
599
  flow,
@@ -863,7 +610,7 @@ var TourProvider = ({
863
610
  );
864
611
  const snapshots = await Promise.all(
865
612
  storageKeys.map(
866
- (key) => (0, import_core.resolveMaybePromise)(resolvedStorageAdapter.get(key))
613
+ (key) => _core.resolveMaybePromise.call(void 0, resolvedStorageAdapter2.get(key))
867
614
  )
868
615
  );
869
616
  if (cancelled) return;
@@ -875,10 +622,10 @@ var TourProvider = ({
875
622
  eligible.push({ flow, resolvedState: null, stepIndex: 0 });
876
623
  continue;
877
624
  }
878
- const storedVersionStr = typeof snapshot.version === "number" ? (0, import_core.serializeVersion)({ major: snapshot.version, minor: 0 }) : snapshot.version;
879
- const storedVersion = (0, import_core.parseVersion)(storedVersionStr);
880
- const stepIdMap = (0, import_core.buildStepIdMap)(flow);
881
- const { state: resolvedState } = (0, import_core.handleVersionMismatch)({
625
+ const storedVersionStr = typeof snapshot.version === "number" ? _core.serializeVersion.call(void 0, { major: snapshot.version, minor: 0 }) : snapshot.version;
626
+ const storedVersion = _core.parseVersion.call(void 0, storedVersionStr);
627
+ const stepIdMap = _core.buildStepIdMap.call(void 0, flow);
628
+ const { state: resolvedState } = _core.handleVersionMismatch.call(void 0, {
882
629
  storedState: snapshot.value,
883
630
  storedVersion,
884
631
  definition: flow,
@@ -900,7 +647,7 @@ var TourProvider = ({
900
647
  cancelled = true;
901
648
  };
902
649
  }, [flows, storageAdapter, storageNamespace]);
903
- (0, import_react6.useEffect)(() => {
650
+ _react.useEffect.call(void 0, () => {
904
651
  if (eligibleFlows.length === 0) {
905
652
  autoStartRequestedRef.current = null;
906
653
  return;
@@ -909,7 +656,7 @@ var TourProvider = ({
909
656
  const findMatchingFlow = (path) => {
910
657
  for (const { flow, stepIndex } of eligibleFlows) {
911
658
  const step = flow.steps[stepIndex];
912
- if (!step.route || matchRoute({ pattern: step.route, path })) {
659
+ if (!step.route || _chunkD5LQLRSUcjs.matchRoute.call(void 0, { pattern: step.route, path })) {
913
660
  return flow;
914
661
  }
915
662
  }
@@ -923,9 +670,9 @@ var TourProvider = ({
923
670
  startFlow(flow.id, { resume: true });
924
671
  }
925
672
  };
926
- const currentPath = getCurrentRoutePath();
673
+ const currentPath = _chunkD5LQLRSUcjs.getCurrentRoutePath.call(void 0, );
927
674
  tryStart(currentPath);
928
- const unsubscribe = subscribeToRouteChanges((path) => {
675
+ const unsubscribe = _chunkD5LQLRSUcjs.subscribeToRouteChanges.call(void 0, (path) => {
929
676
  tryStart(path);
930
677
  });
931
678
  return () => {
@@ -935,14 +682,14 @@ var TourProvider = ({
935
682
  }
936
683
  };
937
684
  }, [activeFlowId, eligibleFlows, startFlow]);
938
- const next = (0, import_react6.useCallback)(() => getActiveStore().next(), [getActiveStore]);
939
- const back = (0, import_react6.useCallback)(() => getActiveStore().back(), [getActiveStore]);
940
- const goToStep = (0, import_react6.useCallback)(
685
+ const next = _react.useCallback.call(void 0, () => getActiveStore().next(), [getActiveStore]);
686
+ const back = _react.useCallback.call(void 0, () => getActiveStore().back(), [getActiveStore]);
687
+ const goToStep = _react.useCallback.call(void 0,
941
688
  (step) => getActiveStore().goToStep(step),
942
689
  [getActiveStore]
943
690
  );
944
- const pause = (0, import_react6.useCallback)(() => getActiveStore().pause(), [getActiveStore]);
945
- const resume = (0, import_react6.useCallback)(() => {
691
+ const pause = _react.useCallback.call(void 0, () => getActiveStore().pause(), [getActiveStore]);
692
+ const resume = _react.useCallback.call(void 0, () => {
946
693
  const store = getActiveStore();
947
694
  const previousState = store.getState();
948
695
  if (previousState.status === "paused") {
@@ -960,31 +707,31 @@ var TourProvider = ({
960
707
  }
961
708
  return result;
962
709
  }, [getActiveStore, resolveResumeStrategy, runResumeHooks]);
963
- const cancel = (0, import_react6.useCallback)(
710
+ const cancel = _react.useCallback.call(void 0,
964
711
  (reason) => getActiveStore().cancel(reason),
965
712
  [getActiveStore]
966
713
  );
967
- const complete = (0, import_react6.useCallback)(
714
+ const complete = _react.useCallback.call(void 0,
968
715
  () => getActiveStore().complete(),
969
716
  [getActiveStore]
970
717
  );
971
- const advanceStep = (0, import_react6.useCallback)(
718
+ const advanceStep = _react.useCallback.call(void 0,
972
719
  (stepId) => getActiveStore().advanceStep(stepId),
973
720
  [getActiveStore]
974
721
  );
975
- const toggleDebug = (0, import_react6.useCallback)(() => {
722
+ const toggleDebug = _react.useCallback.call(void 0, () => {
976
723
  setDebugEnabled((previous) => !previous);
977
724
  }, []);
978
- const activeStep = (0, import_react6.useMemo)(() => {
725
+ const activeStep = _react.useMemo.call(void 0, () => {
979
726
  if (!state || !storeRef.current) return null;
980
727
  if (state.stepIndex < 0) return null;
981
- return storeRef.current.definition.steps[state.stepIndex] ?? null;
728
+ return _nullishCoalesce(storeRef.current.definition.steps[state.stepIndex], () => ( null));
982
729
  }, [state]);
983
- const activeDialogConfig = (0, import_react6.useMemo)(() => {
984
- if (!activeStep?.dialogId || !storeRef.current) return void 0;
985
- return storeRef.current.definition.dialogs?.[activeStep.dialogId];
730
+ const activeDialogConfig = _react.useMemo.call(void 0, () => {
731
+ if (!_optionalChain([activeStep, 'optionalAccess', _22 => _22.dialogId]) || !storeRef.current) return void 0;
732
+ return _optionalChain([storeRef, 'access', _23 => _23.current, 'access', _24 => _24.definition, 'access', _25 => _25.dialogs, 'optionalAccess', _26 => _26[activeStep.dialogId]]);
986
733
  }, [activeStep]);
987
- (0, import_react6.useEffect)(() => {
734
+ _react.useEffect.call(void 0, () => {
988
735
  if (!activeFlowId) return;
989
736
  if (!pendingResumeRef.current.has(activeFlowId)) return;
990
737
  if (!state || state.status !== "running") return;
@@ -999,7 +746,49 @@ var TourProvider = ({
999
746
  pendingResumeRef.current.delete(activeFlowId);
1000
747
  void runResumeHooks(definition, state, resumeStrategy);
1001
748
  }, [activeFlowId, flowMap, resolveResumeStrategy, runResumeHooks, state]);
1002
- const contextValue = (0, import_react6.useMemo)(
749
+ const resolvedStorageAdapter = _react.useMemo.call(void 0, () => {
750
+ if (storageAdapter) return storageAdapter;
751
+ return _nullishCoalesce(fallbackStorageRef.current, () => ( null));
752
+ }, [storageAdapter]);
753
+ const getStorageKey = _react.useCallback.call(void 0,
754
+ (flowId) => storageNamespace ? `${storageNamespace}:${flowId}` : `${DEFAULT_STORAGE_PREFIX}:${flowId}`,
755
+ [storageNamespace]
756
+ );
757
+ const getFlowState = _react.useCallback.call(void 0,
758
+ async (flowId) => {
759
+ if (!resolvedStorageAdapter) return null;
760
+ const key = getStorageKey(flowId);
761
+ const snapshot = await _core.resolveMaybePromise.call(void 0, resolvedStorageAdapter.get(key));
762
+ if (!snapshot) return null;
763
+ return snapshot.value;
764
+ },
765
+ [resolvedStorageAdapter, getStorageKey]
766
+ );
767
+ const deleteFlowStorage = _react.useCallback.call(void 0,
768
+ async (flowId) => {
769
+ if (!resolvedStorageAdapter) return;
770
+ const key = getStorageKey(flowId);
771
+ await _core.resolveMaybePromise.call(void 0, resolvedStorageAdapter.remove(key));
772
+ },
773
+ [resolvedStorageAdapter, getStorageKey]
774
+ );
775
+ const updateFlowStorage = _react.useCallback.call(void 0,
776
+ async (flowId, newState) => {
777
+ if (!resolvedStorageAdapter) return;
778
+ const key = getStorageKey(flowId);
779
+ const definition = flowMap.get(flowId);
780
+ if (!definition) return;
781
+ await _core.resolveMaybePromise.call(void 0,
782
+ resolvedStorageAdapter.set(key, {
783
+ version: newState.version,
784
+ value: newState,
785
+ updatedAt: Date.now()
786
+ })
787
+ );
788
+ },
789
+ [resolvedStorageAdapter, getStorageKey, flowMap]
790
+ );
791
+ const contextValue = _react.useMemo.call(void 0,
1003
792
  () => ({
1004
793
  flows: flowMap,
1005
794
  activeFlowId,
@@ -1022,7 +811,10 @@ var TourProvider = ({
1022
811
  delayInfo,
1023
812
  setDelayInfo,
1024
813
  backdropInteraction: backdropInteractionProp,
1025
- lockBodyScroll: lockBodyScrollProp
814
+ lockBodyScroll: lockBodyScrollProp,
815
+ getFlowState,
816
+ deleteFlowStorage,
817
+ updateFlowStorage
1026
818
  }),
1027
819
  [
1028
820
  activeFlowId,
@@ -1046,7 +838,10 @@ var TourProvider = ({
1046
838
  state,
1047
839
  toggleDebug,
1048
840
  backdropInteractionProp,
1049
- lockBodyScrollProp
841
+ lockBodyScrollProp,
842
+ getFlowState,
843
+ deleteFlowStorage,
844
+ updateFlowStorage
1050
845
  ]
1051
846
  );
1052
847
  const resolvedAnimationAdapter = usePreferredAnimationAdapter({
@@ -1054,8 +849,71 @@ var TourProvider = ({
1054
849
  reducedMotionAdapter,
1055
850
  enabled: autoDetectReducedMotion
1056
851
  });
1057
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AnimationAdapterProvider, { adapter: resolvedAnimationAdapter, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LabelsProvider, { value: mergedLabels, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DialogRegistryProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(TourContext.Provider, { value: contextValue, children: [
1058
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
852
+ const devToolsContextValue = _react.useMemo.call(void 0, () => {
853
+ return {
854
+ flows: flowMap,
855
+ activeFlowId,
856
+ state,
857
+ storageAdapter: resolvedStorageAdapter,
858
+ storageNamespace: _nullishCoalesce(storageNamespace, () => ( DEFAULT_STORAGE_PREFIX)),
859
+ cancelFlow: (flowId) => {
860
+ if (activeFlowId === flowId && storeRef.current) {
861
+ storeRef.current.cancel();
862
+ }
863
+ },
864
+ deleteFlowStorage,
865
+ updateFlowStorage,
866
+ getFlowState
867
+ };
868
+ }, [
869
+ flowMap,
870
+ activeFlowId,
871
+ state,
872
+ resolvedStorageAdapter,
873
+ storageNamespace,
874
+ deleteFlowStorage,
875
+ updateFlowStorage,
876
+ getFlowState
877
+ ]);
878
+ _react.useEffect.call(void 0, () => {
879
+ if (typeof window === "undefined") return;
880
+ const bridgeValue = {
881
+ flows: flowMap,
882
+ activeFlowId,
883
+ state,
884
+ cancel: () => {
885
+ if (storeRef.current) {
886
+ storeRef.current.cancel();
887
+ }
888
+ },
889
+ getFlowState,
890
+ deleteFlowStorage,
891
+ updateFlowStorage
892
+ };
893
+ const w = window;
894
+ if (!w[DEVTOOLS_BRIDGE_KEY]) {
895
+ w[DEVTOOLS_BRIDGE_KEY] = { value: null, listeners: /* @__PURE__ */ new Set() };
896
+ }
897
+ const bridge = w[DEVTOOLS_BRIDGE_KEY];
898
+ bridge.value = bridgeValue;
899
+ for (const listener of bridge.listeners) {
900
+ listener(bridgeValue);
901
+ }
902
+ }, [flowMap, activeFlowId, state, getFlowState, deleteFlowStorage, updateFlowStorage]);
903
+ _react.useEffect.call(void 0, () => {
904
+ return () => {
905
+ if (typeof window === "undefined") return;
906
+ const w = window;
907
+ if (w[DEVTOOLS_BRIDGE_KEY]) {
908
+ w[DEVTOOLS_BRIDGE_KEY].value = null;
909
+ for (const listener of w[DEVTOOLS_BRIDGE_KEY].listeners) {
910
+ listener(null);
911
+ }
912
+ }
913
+ };
914
+ }, []);
915
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnimationAdapterProvider, { adapter: resolvedAnimationAdapter, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LabelsProvider, { value: mergedLabels, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogRegistryProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TourContext.Provider, { value: contextValue, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFCOKCGV3cjs.DevToolsContext.Provider, { value: devToolsContextValue, children: [
916
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1059
917
  DialogAutomationBridge,
1060
918
  {
1061
919
  flow: activeFlowId ? flowMap.get(activeFlowId) : void 0,
@@ -1064,7 +922,7 @@ var TourProvider = ({
1064
922
  }
1065
923
  ),
1066
924
  children
1067
- ] }) }) }) });
925
+ ] }) }) }) }) });
1068
926
  };
1069
927
  var DialogAutomationBridge = ({
1070
928
  flow,
@@ -1088,7 +946,7 @@ var DialogAutomationBridge = ({
1088
946
  return null;
1089
947
  };
1090
948
  var useTour = () => {
1091
- const context = (0, import_react6.useContext)(TourContext);
949
+ const context = _react.useContext.call(void 0, TourContext);
1092
950
  if (!context) {
1093
951
  throw new Error("useTour must be used within a TourProvider");
1094
952
  }
@@ -1096,14 +954,14 @@ var useTour = () => {
1096
954
  };
1097
955
  var useTourEvents = (event, handler) => {
1098
956
  const { events } = useTour();
1099
- (0, import_react6.useEffect)(() => {
957
+ _react.useEffect.call(void 0, () => {
1100
958
  if (!events) return;
1101
959
  return events.on(event, handler);
1102
960
  }, [event, events, handler]);
1103
961
  };
1104
962
 
1105
963
  // src/hooks/useTourTarget.ts
1106
- var import_react7 = require("react");
964
+
1107
965
 
1108
966
  // src/hooks/scrollMargin.ts
1109
967
  var DEFAULT_SCROLL_MARGIN = 16;
@@ -1124,10 +982,10 @@ var resolveScrollMargin = (margin, fallback = DEFAULT_SCROLL_MARGIN) => {
1124
982
  };
1125
983
  }
1126
984
  return {
1127
- top: sanitize(margin?.top, fallback),
1128
- bottom: sanitize(margin?.bottom, fallback),
1129
- left: sanitize(margin?.left, fallback),
1130
- right: sanitize(margin?.right, fallback)
985
+ top: sanitize(_optionalChain([margin, 'optionalAccess', _27 => _27.top]), fallback),
986
+ bottom: sanitize(_optionalChain([margin, 'optionalAccess', _28 => _28.bottom]), fallback),
987
+ left: sanitize(_optionalChain([margin, 'optionalAccess', _29 => _29.left]), fallback),
988
+ right: sanitize(_optionalChain([margin, 'optionalAccess', _30 => _30.right]), fallback)
1131
989
  };
1132
990
  };
1133
991
 
@@ -1146,8 +1004,8 @@ var createWaitForPredicateController = ({
1146
1004
  onChange,
1147
1005
  warn = defaultWarn
1148
1006
  }) => {
1149
- const hasPredicate = Boolean(waitFor?.predicate && context);
1150
- const hasSubscription = Boolean(waitFor?.subscribe && context);
1007
+ const hasPredicate = Boolean(_optionalChain([waitFor, 'optionalAccess', _31 => _31.predicate]) && context);
1008
+ const hasSubscription = Boolean(_optionalChain([waitFor, 'optionalAccess', _32 => _32.subscribe]) && context);
1151
1009
  let satisfied = !hasPredicate && !hasSubscription;
1152
1010
  let destroyed = false;
1153
1011
  let pollId = null;
@@ -1157,10 +1015,10 @@ var createWaitForPredicateController = ({
1157
1015
  const normalized = Boolean(nextValue);
1158
1016
  if (satisfied === normalized) return;
1159
1017
  satisfied = normalized;
1160
- onChange?.(satisfied);
1018
+ _optionalChain([onChange, 'optionalCall', _33 => _33(satisfied)]);
1161
1019
  };
1162
1020
  const evaluate = () => {
1163
- if (!waitFor?.predicate || !context || destroyed) {
1021
+ if (!_optionalChain([waitFor, 'optionalAccess', _34 => _34.predicate]) || !context || destroyed) {
1164
1022
  return;
1165
1023
  }
1166
1024
  const checkId = ++lastCheckId;
@@ -1189,7 +1047,7 @@ var createWaitForPredicateController = ({
1189
1047
  update(Boolean(result));
1190
1048
  };
1191
1049
  const attachSubscription = () => {
1192
- if (!waitFor?.subscribe || !context) return;
1050
+ if (!_optionalChain([waitFor, 'optionalAccess', _35 => _35.subscribe]) || !context) return;
1193
1051
  try {
1194
1052
  const cleanup = waitFor.subscribe({
1195
1053
  ...context,
@@ -1213,9 +1071,9 @@ var createWaitForPredicateController = ({
1213
1071
  destroyed = false;
1214
1072
  satisfied = !hasPredicate && !hasSubscription;
1215
1073
  lastCheckId = 0;
1216
- if (waitFor?.predicate && context) {
1074
+ if (_optionalChain([waitFor, 'optionalAccess', _36 => _36.predicate]) && context) {
1217
1075
  evaluate();
1218
- const pollMs = Math.max(0, waitFor.pollMs ?? 200);
1076
+ const pollMs = Math.max(0, _nullishCoalesce(waitFor.pollMs, () => ( 200)));
1219
1077
  if (pollMs > 0) {
1220
1078
  pollId = window.setInterval(evaluate, pollMs);
1221
1079
  }
@@ -1275,7 +1133,7 @@ var computeRectSource = (rect, storedRect, isScreen) => {
1275
1133
  return "none";
1276
1134
  };
1277
1135
  var computeVisibilityState = (element, rect, isScreen) => {
1278
- if (!isBrowser) return "unknown";
1136
+ if (!_chunkD5LQLRSUcjs.isBrowser) return "unknown";
1279
1137
  if (isScreen) return "visible";
1280
1138
  if (!element) return "missing";
1281
1139
  if (!document.documentElement.contains(element)) return "detached";
@@ -1291,7 +1149,7 @@ var computeVisibilityState = (element, rect, isScreen) => {
1291
1149
  return "visible";
1292
1150
  };
1293
1151
  var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1294
- if (!isBrowser) return;
1152
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1295
1153
  if (Math.abs(topDelta) < 0.5 && Math.abs(leftDelta) < 0.5) {
1296
1154
  return;
1297
1155
  }
@@ -1300,7 +1158,7 @@ var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1300
1158
  window.scrollBy({
1301
1159
  top: topDelta,
1302
1160
  left: leftDelta,
1303
- behavior: behavior ?? "auto"
1161
+ behavior: _nullishCoalesce(behavior, () => ( "auto"))
1304
1162
  });
1305
1163
  return;
1306
1164
  }
@@ -1309,7 +1167,7 @@ var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1309
1167
  elementContainer.scrollBy({
1310
1168
  top: topDelta,
1311
1169
  left: leftDelta,
1312
- behavior: behavior ?? "auto"
1170
+ behavior: _nullishCoalesce(behavior, () => ( "auto"))
1313
1171
  });
1314
1172
  return;
1315
1173
  }
@@ -1318,8 +1176,8 @@ var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1318
1176
  };
1319
1177
  var alignWithinViewport = (element, margin, behavior, mode) => {
1320
1178
  if (mode === "preserve") return;
1321
- const viewportRect = getViewportRect();
1322
- const finalRect = getClientRect(element);
1179
+ const viewportRect = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
1180
+ const finalRect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1323
1181
  const availableHeight = viewportRect.height - (margin.top + margin.bottom);
1324
1182
  if (availableHeight <= 0) return;
1325
1183
  const desiredTop = mode === "center" ? margin.top + (availableHeight - finalRect.height) / 2 : margin.top;
@@ -1327,21 +1185,21 @@ var alignWithinViewport = (element, margin, behavior, mode) => {
1327
1185
  if (Math.abs(delta) < 0.5) return;
1328
1186
  window.scrollBy({
1329
1187
  top: delta,
1330
- behavior: behavior ?? "auto"
1188
+ behavior: _nullishCoalesce(behavior, () => ( "auto"))
1331
1189
  });
1332
1190
  };
1333
1191
  var ensureElementInView = (element, margin, options) => {
1334
- const behavior = options?.behavior ?? "auto";
1335
- const mode = options?.mode ?? "preserve";
1336
- if (!isBrowser) return;
1337
- const scrollParents = getScrollParents(element);
1192
+ const behavior = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _37 => _37.behavior]), () => ( "auto"));
1193
+ const mode = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _38 => _38.mode]), () => ( "preserve"));
1194
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1195
+ const scrollParents = _chunkD5LQLRSUcjs.getScrollParents.call(void 0, element);
1338
1196
  const rootScroller = document.scrollingElement;
1339
1197
  if (rootScroller && !scrollParents.includes(rootScroller)) {
1340
1198
  scrollParents.push(rootScroller);
1341
1199
  }
1342
1200
  for (const container of scrollParents) {
1343
- const containerRect = container === rootScroller || container === document.body || container === document.documentElement ? getViewportRect() : getClientRect(container);
1344
- const targetRect = getClientRect(element);
1201
+ const containerRect = container === rootScroller || container === document.body || container === document.documentElement ? _chunkD5LQLRSUcjs.getViewportRect.call(void 0, ) : _chunkD5LQLRSUcjs.getClientRect.call(void 0, container);
1202
+ const targetRect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1345
1203
  let topDelta = 0;
1346
1204
  if (targetRect.top < containerRect.top + margin.top) {
1347
1205
  topDelta = targetRect.top - (containerRect.top + margin.top);
@@ -1358,8 +1216,8 @@ var ensureElementInView = (element, margin, options) => {
1358
1216
  scrollContainerBy(container, topDelta, leftDelta, behavior);
1359
1217
  }
1360
1218
  }
1361
- const viewportRect = getViewportRect();
1362
- const finalRect = getClientRect(element);
1219
+ const viewportRect = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
1220
+ const finalRect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1363
1221
  let viewportTopDelta = 0;
1364
1222
  if (finalRect.top < viewportRect.top + margin.top) {
1365
1223
  viewportTopDelta = finalRect.top - (viewportRect.top + margin.top);
@@ -1382,7 +1240,7 @@ var ensureElementInView = (element, margin, options) => {
1382
1240
  alignWithinViewport(element, margin, behavior, mode);
1383
1241
  };
1384
1242
  var resolveStepTarget = (target) => {
1385
- if (!isBrowser) return null;
1243
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
1386
1244
  if (target === "screen") {
1387
1245
  return document.body;
1388
1246
  }
@@ -1392,13 +1250,13 @@ var resolveStepTarget = (target) => {
1392
1250
  if (node) {
1393
1251
  return node;
1394
1252
  }
1395
- } catch {
1253
+ } catch (e) {
1396
1254
  }
1397
1255
  }
1398
1256
  if (target.selector) {
1399
1257
  try {
1400
1258
  return document.querySelector(target.selector);
1401
- } catch {
1259
+ } catch (e2) {
1402
1260
  return null;
1403
1261
  }
1404
1262
  }
@@ -1406,14 +1264,14 @@ var resolveStepTarget = (target) => {
1406
1264
  };
1407
1265
  var useTourTarget = () => {
1408
1266
  const { activeStep, state, activeFlowId, flows } = useTour();
1409
- const [targetInfo, setTargetInfo] = (0, import_react7.useState)(INITIAL_TARGET_INFO);
1410
- const autoScrollStateRef = (0, import_react7.useRef)({ stepId: null, checks: 0, stalledChecks: 0, done: false, lastRect: null });
1411
- const autoScrollRafRef = (0, import_react7.useRef)(null);
1412
- const autoScrollTimeoutRef = (0, import_react7.useRef)(null);
1413
- const lastRectRef = (0, import_react7.useRef)(null);
1414
- const initialScrollStepRef = (0, import_react7.useRef)(null);
1267
+ const [targetInfo, setTargetInfo] = _react.useState.call(void 0, INITIAL_TARGET_INFO);
1268
+ const autoScrollStateRef = _react.useRef.call(void 0, { stepId: null, checks: 0, stalledChecks: 0, done: false, lastRect: null });
1269
+ const autoScrollRafRef = _react.useRef.call(void 0, null);
1270
+ const autoScrollTimeoutRef = _react.useRef.call(void 0, null);
1271
+ const lastRectRef = _react.useRef.call(void 0, null);
1272
+ const initialScrollStepRef = _react.useRef.call(void 0, null);
1415
1273
  const cancelAutoScrollLoop = () => {
1416
- if (!isBrowser) return;
1274
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1417
1275
  if (autoScrollTimeoutRef.current !== null) {
1418
1276
  globalThis.clearTimeout(autoScrollTimeoutRef.current);
1419
1277
  autoScrollTimeoutRef.current = null;
@@ -1423,16 +1281,16 @@ var useTourTarget = () => {
1423
1281
  autoScrollRafRef.current = null;
1424
1282
  }
1425
1283
  };
1426
- (0, import_react7.useEffect)(() => {
1284
+ _react.useEffect.call(void 0, () => {
1427
1285
  if (!activeStep) {
1428
1286
  initialScrollStepRef.current = null;
1429
1287
  }
1430
1288
  return () => {
1431
1289
  initialScrollStepRef.current = null;
1432
1290
  };
1433
- }, [activeStep?.id]);
1434
- (0, import_react7.useLayoutEffect)(() => {
1435
- if (!isBrowser) return;
1291
+ }, [_optionalChain([activeStep, 'optionalAccess', _39 => _39.id])]);
1292
+ _react.useLayoutEffect.call(void 0, () => {
1293
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1436
1294
  if (!activeStep) return;
1437
1295
  if (targetInfo.status !== "ready") return;
1438
1296
  if (targetInfo.isScreen) return;
@@ -1442,10 +1300,10 @@ var useTourTarget = () => {
1442
1300
  }
1443
1301
  initialScrollStepRef.current = activeStep.id;
1444
1302
  const margin = resolveScrollMargin(
1445
- activeStep.targetBehavior?.scrollMargin,
1303
+ _optionalChain([activeStep, 'access', _40 => _40.targetBehavior, 'optionalAccess', _41 => _41.scrollMargin]),
1446
1304
  DEFAULT_SCROLL_MARGIN
1447
1305
  );
1448
- const scrollMode = activeStep.targetBehavior?.scrollMode ?? DEFAULT_SCROLL_MODE;
1306
+ const scrollMode = _nullishCoalesce(_optionalChain([activeStep, 'access', _42 => _42.targetBehavior, 'optionalAccess', _43 => _43.scrollMode]), () => ( DEFAULT_SCROLL_MODE));
1449
1307
  const hasLiveRect = targetInfo.rectSource === "live";
1450
1308
  const scrollBehavior = hasLiveRect ? "smooth" : "auto";
1451
1309
  ensureElementInView(targetInfo.element, margin, {
@@ -1453,9 +1311,9 @@ var useTourTarget = () => {
1453
1311
  mode: scrollMode
1454
1312
  });
1455
1313
  }, [
1456
- activeStep?.id,
1457
- activeStep?.targetBehavior?.scrollMargin,
1458
- activeStep?.targetBehavior?.scrollMode,
1314
+ _optionalChain([activeStep, 'optionalAccess', _44 => _44.id]),
1315
+ _optionalChain([activeStep, 'optionalAccess', _45 => _45.targetBehavior, 'optionalAccess', _46 => _46.scrollMargin]),
1316
+ _optionalChain([activeStep, 'optionalAccess', _47 => _47.targetBehavior, 'optionalAccess', _48 => _48.scrollMode]),
1459
1317
  targetInfo.rect,
1460
1318
  targetInfo.lastResolvedRect,
1461
1319
  targetInfo.element,
@@ -1463,7 +1321,7 @@ var useTourTarget = () => {
1463
1321
  targetInfo.status,
1464
1322
  targetInfo.rectSource
1465
1323
  ]);
1466
- (0, import_react7.useEffect)(() => {
1324
+ _react.useEffect.call(void 0, () => {
1467
1325
  if (!activeStep || !state || state.status !== "running") {
1468
1326
  setTargetInfo(INITIAL_TARGET_INFO);
1469
1327
  autoScrollStateRef.current = {
@@ -1476,8 +1334,8 @@ var useTourTarget = () => {
1476
1334
  cancelAutoScrollLoop();
1477
1335
  return;
1478
1336
  }
1479
- if (!isBrowser) {
1480
- const storedRect = lastResolvedRectByStep.get(activeStep.id) ?? null;
1337
+ if (!_chunkD5LQLRSUcjs.isBrowser) {
1338
+ const storedRect = _nullishCoalesce(lastResolvedRectByStep.get(activeStep.id), () => ( null));
1481
1339
  setTargetInfo({
1482
1340
  element: null,
1483
1341
  rect: null,
@@ -1492,12 +1350,12 @@ var useTourTarget = () => {
1492
1350
  return;
1493
1351
  }
1494
1352
  const currentStep = activeStep;
1495
- const activeFlow = activeFlowId ? flows.get(activeFlowId) ?? null : null;
1353
+ const activeFlow = activeFlowId ? _nullishCoalesce(flows.get(activeFlowId), () => ( null)) : null;
1496
1354
  const isScreen = currentStep.target === "screen";
1497
- const waitForSelectorRaw = currentStep.waitFor?.selector;
1355
+ const waitForSelectorRaw = _optionalChain([currentStep, 'access', _49 => _49.waitFor, 'optionalAccess', _50 => _50.selector]);
1498
1356
  const waitForSelector = typeof waitForSelectorRaw === "string" ? waitForSelectorRaw.trim() : void 0;
1499
1357
  const hasWaitForSelector = Boolean(waitForSelector);
1500
- const waitForTimeout = Math.max(0, currentStep.waitFor?.timeout ?? 8e3);
1358
+ const waitForTimeout = Math.max(0, _nullishCoalesce(_optionalChain([currentStep, 'access', _51 => _51.waitFor, 'optionalAccess', _52 => _52.timeout]), () => ( 8e3)));
1501
1359
  const waitContext = activeFlow ? {
1502
1360
  flow: activeFlow,
1503
1361
  state,
@@ -1559,12 +1417,12 @@ var useTourTarget = () => {
1559
1417
  };
1560
1418
  const isWaitForSatisfied = () => {
1561
1419
  const selectorReady = !hasWaitForSelector || isWaitForSelectorSatisfied();
1562
- const predicateReady = waitForPredicateController?.isSatisfied() ?? true;
1420
+ const predicateReady = _nullishCoalesce(_optionalChain([waitForPredicateController, 'optionalAccess', _53 => _53.isSatisfied, 'call', _54 => _54()]), () => ( true));
1563
1421
  return selectorReady && predicateReady;
1564
1422
  };
1565
1423
  function updateTargetState(status, rectOverride) {
1566
1424
  if (cancelled) return;
1567
- const rect = typeof rectOverride !== "undefined" ? rectOverride : isScreen ? getViewportRect() : element ? getClientRect(element) : null;
1425
+ const rect = typeof rectOverride !== "undefined" ? rectOverride : isScreen ? _chunkD5LQLRSUcjs.getViewportRect.call(void 0, ) : element ? _chunkD5LQLRSUcjs.getClientRect.call(void 0, element) : null;
1568
1426
  if (status === "ready" && hasWaitForSelector && waitForStartedAt === null) {
1569
1427
  waitForStartedAt = Date.now();
1570
1428
  }
@@ -1586,7 +1444,7 @@ var useTourTarget = () => {
1586
1444
  if (waitConditionMet) {
1587
1445
  clearWaitForPoll();
1588
1446
  }
1589
- const storedRect = lastResolvedRectByStep.get(currentStep.id) ?? null;
1447
+ const storedRect = _nullishCoalesce(lastResolvedRectByStep.get(currentStep.id), () => ( null));
1590
1448
  const shouldUpdate = !hasEmitted || rectChanged(rect) || lastStatus !== nextStatus || element !== lastElement;
1591
1449
  if (!shouldUpdate) {
1592
1450
  return;
@@ -1594,16 +1452,16 @@ var useTourTarget = () => {
1594
1452
  lastRectRef.current = rect ? { ...rect } : null;
1595
1453
  lastStatus = nextStatus;
1596
1454
  hasEmitted = true;
1597
- lastElement = element ?? null;
1455
+ lastElement = _nullishCoalesce(element, () => ( null));
1598
1456
  const shouldPersistRect = nextStatus === "ready" && !isScreen && rectHasMeaningfulSize(rect);
1599
1457
  if (shouldPersistRect && rect) {
1600
1458
  lastResolvedRectByStep.set(currentStep.id, { ...rect });
1601
1459
  }
1602
1460
  const lastResolvedRect = shouldPersistRect && rect ? { ...rect } : storedRect ? { ...storedRect } : null;
1603
- const visibility = computeVisibilityState(element ?? null, rect, isScreen);
1461
+ const visibility = computeVisibilityState(_nullishCoalesce(element, () => ( null)), rect, isScreen);
1604
1462
  const rectSource = computeRectSource(rect, lastResolvedRect, isScreen);
1605
1463
  setTargetInfo({
1606
- element: element ?? null,
1464
+ element: _nullishCoalesce(element, () => ( null)),
1607
1465
  rect,
1608
1466
  lastResolvedRect,
1609
1467
  isScreen,
@@ -1632,14 +1490,14 @@ var useTourTarget = () => {
1632
1490
  }
1633
1491
  }
1634
1492
  function startRafMonitor() {
1635
- if (isScreen || !isBrowser) return;
1493
+ if (isScreen || !_chunkD5LQLRSUcjs.isBrowser) return;
1636
1494
  stopRaf();
1637
1495
  const tick = () => {
1638
1496
  if (cancelled) return;
1639
1497
  if (!element) {
1640
1498
  updateTargetState("resolving", null);
1641
1499
  } else {
1642
- const rect = getClientRect(element);
1500
+ const rect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1643
1501
  if (rectChanged(rect)) {
1644
1502
  updateTargetState("ready", rect);
1645
1503
  }
@@ -1681,14 +1539,14 @@ var useTourTarget = () => {
1681
1539
  window.visualViewport.addEventListener("resize", onViewportChange);
1682
1540
  window.visualViewport.addEventListener("scroll", onViewportChange);
1683
1541
  cleanupFns.push(() => {
1684
- window.visualViewport?.removeEventListener(
1542
+ _optionalChain([window, 'access', _55 => _55.visualViewport, 'optionalAccess', _56 => _56.removeEventListener, 'call', _57 => _57(
1685
1543
  "resize",
1686
1544
  onViewportChange
1687
- );
1688
- window.visualViewport?.removeEventListener(
1545
+ )]);
1546
+ _optionalChain([window, 'access', _58 => _58.visualViewport, 'optionalAccess', _59 => _59.removeEventListener, 'call', _60 => _60(
1689
1547
  "scroll",
1690
1548
  onViewportChange
1691
- );
1549
+ )]);
1692
1550
  });
1693
1551
  }
1694
1552
  } else if (element) {
@@ -1704,7 +1562,7 @@ var useTourTarget = () => {
1704
1562
  window.removeEventListener("scroll", onReposition, true);
1705
1563
  });
1706
1564
  const onAncestorScroll = () => commitInfo("ready");
1707
- scrollParents = getScrollParents(element);
1565
+ scrollParents = _chunkD5LQLRSUcjs.getScrollParents.call(void 0, element);
1708
1566
  if (scrollParents.length > 0) {
1709
1567
  scrollParents.forEach(
1710
1568
  (parent) => parent.addEventListener("scroll", onAncestorScroll, {
@@ -1735,7 +1593,7 @@ var useTourTarget = () => {
1735
1593
  subtree: true
1736
1594
  });
1737
1595
  cleanupFns.push(() => {
1738
- mutationObserver?.disconnect();
1596
+ _optionalChain([mutationObserver, 'optionalAccess', _61 => _61.disconnect, 'call', _62 => _62()]);
1739
1597
  mutationObserver = null;
1740
1598
  });
1741
1599
  }
@@ -1782,12 +1640,12 @@ var useTourTarget = () => {
1782
1640
  clearResolvePolling();
1783
1641
  clearWaitForPoll();
1784
1642
  resetObservers();
1785
- waitForPredicateController?.stop();
1643
+ _optionalChain([waitForPredicateController, 'optionalAccess', _63 => _63.stop, 'call', _64 => _64()]);
1786
1644
  waitForPredicateController = null;
1787
1645
  };
1788
1646
  }, [activeStep, activeFlowId, flows, state]);
1789
- (0, import_react7.useEffect)(() => {
1790
- if (!isBrowser) return;
1647
+ _react.useEffect.call(void 0, () => {
1648
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1791
1649
  if (!activeStep) {
1792
1650
  cancelAutoScrollLoop();
1793
1651
  return;
@@ -1817,16 +1675,16 @@ var useTourTarget = () => {
1817
1675
  return;
1818
1676
  }
1819
1677
  const { element } = targetInfo;
1820
- const scrollMode = activeStep.targetBehavior?.scrollMode ?? "center";
1678
+ const scrollMode = _nullishCoalesce(_optionalChain([activeStep, 'access', _65 => _65.targetBehavior, 'optionalAccess', _66 => _66.scrollMode]), () => ( "center"));
1821
1679
  const runCheck = () => {
1822
1680
  autoScrollRafRef.current = null;
1823
- if (!isBrowser) return;
1681
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1824
1682
  if (autoState.stepId !== activeStep.id) return;
1825
1683
  if (!element.isConnected) return;
1826
- const rect = getClientRect(element);
1827
- const viewport = getViewportRect();
1684
+ const rect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1685
+ const viewport = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
1828
1686
  const margin = resolveScrollMargin(
1829
- activeStep.targetBehavior?.scrollMargin,
1687
+ _optionalChain([activeStep, 'access', _67 => _67.targetBehavior, 'optionalAccess', _68 => _68.scrollMargin]),
1830
1688
  DEFAULT_SCROLL_MARGIN
1831
1689
  );
1832
1690
  const fitsHeight = rect.height <= viewport.height - (margin.top + margin.bottom);
@@ -1862,23 +1720,23 @@ var useTourTarget = () => {
1862
1720
  cancelAutoScrollLoop();
1863
1721
  autoScrollRafRef.current = window.requestAnimationFrame(runCheck);
1864
1722
  return cancelAutoScrollLoop;
1865
- }, [activeStep, activeStep?.targetBehavior?.scrollMode, targetInfo]);
1723
+ }, [activeStep, _optionalChain([activeStep, 'optionalAccess', _69 => _69.targetBehavior, 'optionalAccess', _70 => _70.scrollMode]), targetInfo]);
1866
1724
  return targetInfo;
1867
1725
  };
1868
1726
 
1869
1727
  // src/hooks/useHudState.ts
1870
- var import_react12 = require("react");
1728
+
1871
1729
 
1872
1730
  // src/hooks/useAdvanceRules.ts
1873
- var import_react8 = require("react");
1874
- var DEFAULT_POLL_MS2 = 250;
1731
+
1732
+ var DEFAULT_POLL_MS = 250;
1875
1733
  var isListenerTarget = (value) => {
1876
1734
  return !!value && typeof value.addEventListener === "function" && typeof value.removeEventListener === "function";
1877
1735
  };
1878
1736
  var resolveEventTarget = (rule, target) => {
1879
- if (!isBrowser) return null;
1737
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
1880
1738
  if (!rule.on || rule.on === "target") {
1881
- return target.element ?? null;
1739
+ return _nullishCoalesce(target.element, () => ( null));
1882
1740
  }
1883
1741
  if (rule.on === "window") {
1884
1742
  return window;
@@ -1888,7 +1746,7 @@ var resolveEventTarget = (rule, target) => {
1888
1746
  }
1889
1747
  try {
1890
1748
  return document.querySelector(rule.on);
1891
- } catch {
1749
+ } catch (e3) {
1892
1750
  return null;
1893
1751
  }
1894
1752
  };
@@ -1909,8 +1767,8 @@ var useAdvanceRules = (target) => {
1909
1767
  complete,
1910
1768
  setDelayInfo
1911
1769
  } = useTour();
1912
- (0, import_react8.useEffect)(() => {
1913
- if (!isBrowser) return;
1770
+ _react.useEffect.call(void 0, () => {
1771
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1914
1772
  if (!state || state.status !== "running") return;
1915
1773
  if (!activeStep) return;
1916
1774
  const definition = activeFlowId ? flows.get(activeFlowId) : void 0;
@@ -1924,7 +1782,7 @@ var useAdvanceRules = (target) => {
1924
1782
  while (cleanupFns.length > 0) {
1925
1783
  const dispose = cleanupFns.pop();
1926
1784
  try {
1927
- dispose?.();
1785
+ _optionalChain([dispose, 'optionalCall', _71 => _71()]);
1928
1786
  } catch (error) {
1929
1787
  console.warn("[tour][advance] cleanup failed", error);
1930
1788
  }
@@ -2010,7 +1868,7 @@ var useAdvanceRules = (target) => {
2010
1868
  break;
2011
1869
  }
2012
1870
  case "predicate": {
2013
- const pollMs = Math.max(50, rule.pollMs ?? DEFAULT_POLL_MS2);
1871
+ const pollMs = Math.max(50, _nullishCoalesce(rule.pollMs, () => ( DEFAULT_POLL_MS)));
2014
1872
  const timeoutMs = rule.timeoutMs;
2015
1873
  const executeCheck = () => {
2016
1874
  if (resolved) return;
@@ -2043,12 +1901,12 @@ var useAdvanceRules = (target) => {
2043
1901
  finish();
2044
1902
  }
2045
1903
  };
2046
- const initialPath = getCurrentRoutePath();
1904
+ const initialPath = _chunkD5LQLRSUcjs.getCurrentRoutePath.call(void 0, );
2047
1905
  checkRoute(initialPath);
2048
1906
  if (hasResolved()) {
2049
1907
  break;
2050
1908
  }
2051
- const unsubscribe = subscribeToRouteChanges((path) => {
1909
+ const unsubscribe = _chunkD5LQLRSUcjs.subscribeToRouteChanges.call(void 0, (path) => {
2052
1910
  checkRoute(path);
2053
1911
  });
2054
1912
  addCleanup(unsubscribe);
@@ -2080,7 +1938,7 @@ var useAdvanceRules = (target) => {
2080
1938
  };
2081
1939
 
2082
1940
  // src/hooks/useHiddenTargetFallback.ts
2083
- var import_react9 = require("react");
1941
+
2084
1942
  var DEFAULT_DELAY_MS = 900;
2085
1943
  var DEFAULT_GRACE_PERIOD_MS = 400;
2086
1944
  var useHiddenTargetFallback = ({
@@ -2089,15 +1947,15 @@ var useHiddenTargetFallback = ({
2089
1947
  viewportRect,
2090
1948
  onSkip
2091
1949
  }) => {
2092
- const [usingScreenFallback, setUsingScreenFallback] = (0, import_react9.useState)(false);
2093
- const [isInGracePeriod, setIsInGracePeriod] = (0, import_react9.useState)(false);
2094
- const timeoutRef = (0, import_react9.useRef)(null);
2095
- const graceTimeoutRef = (0, import_react9.useRef)(null);
2096
- const skipTriggeredRef = (0, import_react9.useRef)(false);
2097
- const hiddenMode = step?.targetBehavior?.hidden ?? "screen";
1950
+ const [usingScreenFallback, setUsingScreenFallback] = _react.useState.call(void 0, false);
1951
+ const [isInGracePeriod, setIsInGracePeriod] = _react.useState.call(void 0, false);
1952
+ const timeoutRef = _react.useRef.call(void 0, null);
1953
+ const graceTimeoutRef = _react.useRef.call(void 0, null);
1954
+ const skipTriggeredRef = _react.useRef.call(void 0, false);
1955
+ const hiddenMode = _nullishCoalesce(_optionalChain([step, 'optionalAccess', _72 => _72.targetBehavior, 'optionalAccess', _73 => _73.hidden]), () => ( "screen"));
2098
1956
  const hiddenDelayMs = Math.max(
2099
1957
  0,
2100
- step?.targetBehavior?.hiddenDelayMs ?? DEFAULT_DELAY_MS
1958
+ _nullishCoalesce(_optionalChain([step, 'optionalAccess', _74 => _74.targetBehavior, 'optionalAccess', _75 => _75.hiddenDelayMs]), () => ( DEFAULT_DELAY_MS))
2101
1959
  );
2102
1960
  const clearPendingTimeout = () => {
2103
1961
  if (timeoutRef.current !== null) {
@@ -2111,19 +1969,21 @@ var useHiddenTargetFallback = ({
2111
1969
  graceTimeoutRef.current = null;
2112
1970
  }
2113
1971
  };
2114
- (0, import_react9.useEffect)(() => {
1972
+ const stepChangeTimeRef = _react.useRef.call(void 0, 0);
1973
+ _react.useEffect.call(void 0, () => {
1974
+ stepChangeTimeRef.current = Date.now();
2115
1975
  skipTriggeredRef.current = false;
2116
1976
  setUsingScreenFallback(false);
2117
- setIsInGracePeriod(false);
1977
+ setIsInGracePeriod(true);
2118
1978
  clearPendingTimeout();
2119
1979
  clearGraceTimeout();
2120
1980
  return () => {
2121
1981
  clearPendingTimeout();
2122
1982
  clearGraceTimeout();
2123
1983
  };
2124
- }, [step?.id]);
2125
- (0, import_react9.useEffect)(() => {
2126
- if (!isBrowser) return void 0;
1984
+ }, [_optionalChain([step, 'optionalAccess', _76 => _76.id])]);
1985
+ _react.useEffect.call(void 0, () => {
1986
+ if (!_chunkD5LQLRSUcjs.isBrowser) return void 0;
2127
1987
  if (!step) return void 0;
2128
1988
  clearPendingTimeout();
2129
1989
  clearGraceTimeout();
@@ -2131,11 +1991,22 @@ var useHiddenTargetFallback = ({
2131
1991
  const isMissingWithNoRect = target.visibility === "missing" && target.status === "resolving" && target.rect === null && target.lastResolvedRect === null;
2132
1992
  const isMissingAfterNavigation = target.visibility === "missing" && target.status === "resolving" && target.rect === null;
2133
1993
  const shouldHandleHiddenTarget = !target.isScreen && (isHiddenOrDetached || isMissingWithNoRect || isMissingAfterNavigation);
2134
- if (!shouldHandleHiddenTarget) {
1994
+ const timeSinceStepChange = Date.now() - stepChangeTimeRef.current;
1995
+ const MIN_GRACE_AFTER_STEP_CHANGE = 300;
1996
+ if (!shouldHandleHiddenTarget && target.visibility !== "unknown") {
1997
+ if (timeSinceStepChange < MIN_GRACE_AFTER_STEP_CHANGE) {
1998
+ graceTimeoutRef.current = globalThis.setTimeout(() => {
1999
+ setIsInGracePeriod(false);
2000
+ }, MIN_GRACE_AFTER_STEP_CHANGE - timeSinceStepChange);
2001
+ return void 0;
2002
+ }
2135
2003
  setUsingScreenFallback(false);
2136
2004
  setIsInGracePeriod(false);
2137
2005
  return void 0;
2138
2006
  }
2007
+ if (target.visibility === "unknown") {
2008
+ return void 0;
2009
+ }
2139
2010
  setIsInGracePeriod(true);
2140
2011
  if (hiddenMode !== "screen") {
2141
2012
  setUsingScreenFallback(false);
@@ -2168,7 +2039,7 @@ var useHiddenTargetFallback = ({
2168
2039
  hiddenDelayMs,
2169
2040
  onSkip
2170
2041
  ]);
2171
- const resolvedTarget = (0, import_react9.useMemo)(() => {
2042
+ const resolvedTarget = _react.useMemo.call(void 0, () => {
2172
2043
  if (!usingScreenFallback) {
2173
2044
  return target;
2174
2045
  }
@@ -2190,61 +2061,16 @@ var useHiddenTargetFallback = ({
2190
2061
  };
2191
2062
 
2192
2063
  // src/hooks/useRouteMismatch.ts
2193
- var import_react10 = require("react");
2194
-
2195
- // src/router/utils.ts
2196
- var ensurePrefix = (value, prefix) => value.startsWith(prefix) ? value : `${prefix}${value}`;
2197
- var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
2198
- var toSearchString = (value) => {
2199
- if (!isNonEmptyString(value)) {
2200
- if (value instanceof URLSearchParams) {
2201
- const serialized = value.toString();
2202
- return serialized.length > 0 ? `?${serialized}` : "";
2203
- }
2204
- if (typeof value === "object" && value !== null) {
2205
- try {
2206
- const params = new URLSearchParams();
2207
- for (const [key, raw] of Object.entries(
2208
- value
2209
- )) {
2210
- if (raw === void 0 || raw === null) continue;
2211
- params.set(key, String(raw));
2212
- }
2213
- const serialized = params.toString();
2214
- return serialized.length > 0 ? `?${serialized}` : "";
2215
- } catch {
2216
- return "";
2217
- }
2218
- }
2219
- return "";
2220
- }
2221
- if (value === "?") return "";
2222
- return value.startsWith("?") ? value : ensurePrefix(value, "?");
2223
- };
2224
- var toHashString = (value) => {
2225
- if (!isNonEmptyString(value)) {
2226
- return "";
2227
- }
2228
- if (value === "#") return "";
2229
- return value.startsWith("#") ? value : ensurePrefix(value, "#");
2230
- };
2231
- var createPathString = (pathname, search, hash) => {
2232
- const normalizedPath = isNonEmptyString(pathname) ? pathname.startsWith("/") ? pathname : `/${pathname}` : "/";
2233
- const searchPart = toSearchString(search);
2234
- const hashPart = toHashString(hash);
2235
- return `${normalizedPath}${searchPart}${hashPart}`;
2236
- };
2237
2064
 
2238
- // src/hooks/useRouteMismatch.ts
2239
2065
  var useRouteMismatch = (step) => {
2240
- const [currentPath, setCurrentPath] = (0, import_react10.useState)(() => getCurrentRoutePath());
2241
- (0, import_react10.useEffect)(() => {
2242
- return subscribeToRouteChanges((path) => {
2066
+ const [currentPath, setCurrentPath] = _react.useState.call(void 0, () => _chunkD5LQLRSUcjs.getCurrentRoutePath.call(void 0, ));
2067
+ _react.useEffect.call(void 0, () => {
2068
+ return _chunkD5LQLRSUcjs.subscribeToRouteChanges.call(void 0, (path) => {
2243
2069
  setCurrentPath(path);
2244
2070
  });
2245
2071
  }, []);
2246
- const expectedRoute = step?.route;
2247
- const isRouteMismatch = step !== null && expectedRoute !== void 0 && !matchRoute({ pattern: expectedRoute, path: currentPath });
2072
+ const expectedRoute = _optionalChain([step, 'optionalAccess', _77 => _77.route]);
2073
+ const isRouteMismatch = step !== null && expectedRoute !== void 0 && !_chunkD5LQLRSUcjs.matchRoute.call(void 0, { pattern: expectedRoute, path: currentPath });
2248
2074
  return {
2249
2075
  isRouteMismatch,
2250
2076
  currentPath,
@@ -2253,17 +2079,17 @@ var useRouteMismatch = (step) => {
2253
2079
  };
2254
2080
 
2255
2081
  // src/hooks/useViewportRect.ts
2256
- var import_react11 = require("react");
2082
+
2257
2083
  var useViewportRect = () => {
2258
- const [viewport, setViewport] = (0, import_react11.useState)(
2259
- () => getViewportRect()
2084
+ const [viewport, setViewport] = _react.useState.call(void 0,
2085
+ () => _chunkD5LQLRSUcjs.getViewportRect.call(void 0, )
2260
2086
  );
2261
- const rafRef = (0, import_react11.useRef)(null);
2262
- (0, import_react11.useEffect)(() => {
2263
- if (!isBrowser) return;
2087
+ const rafRef = _react.useRef.call(void 0, null);
2088
+ _react.useEffect.call(void 0, () => {
2089
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
2264
2090
  const updateViewport = () => {
2265
2091
  rafRef.current = null;
2266
- setViewport(getViewportRect());
2092
+ setViewport(_chunkD5LQLRSUcjs.getViewportRect.call(void 0, ));
2267
2093
  };
2268
2094
  const scheduleUpdate = () => {
2269
2095
  if (rafRef.current !== null) return;
@@ -2278,8 +2104,8 @@ var useViewportRect = () => {
2278
2104
  addListener(window, "resize", scheduleUpdate);
2279
2105
  addListener(window, "orientationchange", scheduleUpdate);
2280
2106
  addListener(window, "scroll", scheduleUpdate);
2281
- addListener(window.visualViewport ?? null, "resize", scheduleUpdate);
2282
- addListener(window.visualViewport ?? null, "scroll", scheduleUpdate);
2107
+ addListener(_nullishCoalesce(window.visualViewport, () => ( null)), "resize", scheduleUpdate);
2108
+ addListener(_nullishCoalesce(window.visualViewport, () => ( null)), "scroll", scheduleUpdate);
2283
2109
  return () => {
2284
2110
  listeners.forEach(
2285
2111
  ({ target, type, handler }) => target.removeEventListener(type, handler)
@@ -2301,28 +2127,28 @@ var normalizeFlowFilter = (value) => {
2301
2127
  };
2302
2128
  var useHudState = (options = {}) => {
2303
2129
  const { flowId } = options;
2304
- const flowFilter = (0, import_react12.useMemo)(() => normalizeFlowFilter(flowId), [flowId]);
2130
+ const flowFilter = _react.useMemo.call(void 0, () => normalizeFlowFilter(flowId), [flowId]);
2305
2131
  const { state, activeStep, activeFlowId, flows, next, complete, pause, resume } = useTour();
2306
2132
  const target = useTourTarget();
2307
2133
  const viewportRect = useViewportRect();
2308
2134
  useAdvanceRules(target);
2309
- const matchesFlowFilter = (0, import_react12.useMemo)(() => {
2135
+ const matchesFlowFilter = _react.useMemo.call(void 0, () => {
2310
2136
  if (!flowFilter || flowFilter.length === 0) return true;
2311
2137
  if (!activeFlowId) return false;
2312
2138
  return flowFilter.includes(activeFlowId);
2313
2139
  }, [activeFlowId, flowFilter]);
2314
- const isRunning = state?.status === "running";
2140
+ const isRunning = _optionalChain([state, 'optionalAccess', _78 => _78.status]) === "running";
2315
2141
  const runningState = isRunning && matchesFlowFilter ? state : null;
2316
2142
  const runningStep = runningState && activeStep ? activeStep : null;
2317
- const [shouldRender, setShouldRender] = (0, import_react12.useState)(
2143
+ const [shouldRender, setShouldRender] = _react.useState.call(void 0,
2318
2144
  Boolean(runningStep)
2319
2145
  );
2320
- (0, import_react12.useEffect)(() => {
2146
+ _react.useEffect.call(void 0, () => {
2321
2147
  if (runningStep) {
2322
2148
  setShouldRender(true);
2323
2149
  }
2324
- }, [runningStep?.id]);
2325
- (0, import_react12.useEffect)(() => {
2150
+ }, [_optionalChain([runningStep, 'optionalAccess', _79 => _79.id])]);
2151
+ _react.useEffect.call(void 0, () => {
2326
2152
  if (!shouldRender) return;
2327
2153
  if (runningStep) return;
2328
2154
  if (target.status !== "idle") return;
@@ -2334,19 +2160,19 @@ var useHudState = (options = {}) => {
2334
2160
  };
2335
2161
  }, [runningStep, shouldRender, target.status]);
2336
2162
  const { isRouteMismatch, currentPath } = useRouteMismatch(activeStep);
2337
- const pausedForMissingTargetRef = (0, import_react12.useRef)(null);
2338
- (0, import_react12.useEffect)(() => {
2163
+ const pausedForMissingTargetRef = _react.useRef.call(void 0, null);
2164
+ _react.useEffect.call(void 0, () => {
2339
2165
  if (!isRouteMismatch) return;
2340
2166
  if (!runningState || runningState.status !== "running") return;
2341
2167
  pause();
2342
2168
  }, [isRouteMismatch, runningState, pause]);
2343
- (0, import_react12.useEffect)(() => {
2169
+ _react.useEffect.call(void 0, () => {
2344
2170
  if (isRouteMismatch) return;
2345
2171
  if (pausedForMissingTargetRef.current !== null) return;
2346
2172
  if (!state || state.status !== "paused") return;
2347
2173
  resume();
2348
2174
  }, [isRouteMismatch, state, resume]);
2349
- const skipHiddenStep = (0, import_react12.useCallback)(() => {
2175
+ const skipHiddenStep = _react.useCallback.call(void 0, () => {
2350
2176
  if (!runningState || runningState.status !== "running") return;
2351
2177
  if (!activeFlowId) return;
2352
2178
  const flow = flows.get(activeFlowId);
@@ -2364,9 +2190,9 @@ var useHudState = (options = {}) => {
2364
2190
  viewportRect,
2365
2191
  onSkip: skipHiddenStep
2366
2192
  });
2367
- (0, import_react12.useEffect)(() => {
2193
+ _react.useEffect.call(void 0, () => {
2368
2194
  if (isRouteMismatch) return;
2369
- if (activeStep?.route !== void 0) return;
2195
+ if (_optionalChain([activeStep, 'optionalAccess', _80 => _80.route]) !== void 0) return;
2370
2196
  if (isInGracePeriod) return;
2371
2197
  if (target.visibility !== "missing") return;
2372
2198
  if (target.isScreen) return;
@@ -2375,7 +2201,7 @@ var useHudState = (options = {}) => {
2375
2201
  pause();
2376
2202
  }, [
2377
2203
  isRouteMismatch,
2378
- activeStep?.route,
2204
+ _optionalChain([activeStep, 'optionalAccess', _81 => _81.route]),
2379
2205
  isInGracePeriod,
2380
2206
  target.visibility,
2381
2207
  target.isScreen,
@@ -2383,20 +2209,20 @@ var useHudState = (options = {}) => {
2383
2209
  currentPath,
2384
2210
  pause
2385
2211
  ]);
2386
- (0, import_react12.useEffect)(() => {
2212
+ _react.useEffect.call(void 0, () => {
2387
2213
  if (pausedForMissingTargetRef.current === null) return;
2388
2214
  if (!state || state.status !== "paused") return;
2389
2215
  if (currentPath === pausedForMissingTargetRef.current) return;
2390
2216
  pausedForMissingTargetRef.current = null;
2391
2217
  resume();
2392
2218
  }, [currentPath, state, resume]);
2393
- (0, import_react12.useEffect)(() => {
2219
+ _react.useEffect.call(void 0, () => {
2394
2220
  pausedForMissingTargetRef.current = null;
2395
- }, [activeStep?.id]);
2221
+ }, [_optionalChain([activeStep, 'optionalAccess', _82 => _82.id])]);
2396
2222
  const canRenderStep = Boolean(runningStep && runningState);
2397
2223
  const focusTrapActive = canRenderStep;
2398
- const flowHudOptions = matchesFlowFilter && activeFlowId ? flows.get(activeFlowId)?.hud ?? null : null;
2399
- const hudRenderMode = flowHudOptions?.render ?? "default";
2224
+ const flowHudOptions = matchesFlowFilter && activeFlowId ? _nullishCoalesce(_optionalChain([flows, 'access', _83 => _83.get, 'call', _84 => _84(activeFlowId), 'optionalAccess', _85 => _85.hud]), () => ( null)) : null;
2225
+ const hudRenderMode = _nullishCoalesce(_optionalChain([flowHudOptions, 'optionalAccess', _86 => _86.render]), () => ( "default"));
2400
2226
  return {
2401
2227
  state,
2402
2228
  runningState,
@@ -2415,24 +2241,24 @@ var useHudState = (options = {}) => {
2415
2241
  };
2416
2242
 
2417
2243
  // src/hooks/useHudDescription.ts
2418
- var import_react13 = require("react");
2244
+
2419
2245
  var sanitizeForId = (value) => {
2420
2246
  const normalized = value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
2421
2247
  return normalized.length > 0 ? normalized : "step";
2422
2248
  };
2423
2249
  var useHudDescription = (options) => {
2424
2250
  const { step, fallbackAriaDescribedBy } = options;
2425
- const targetDescription = (0, import_react13.useMemo)(() => {
2251
+ const targetDescription = _react.useMemo.call(void 0, () => {
2426
2252
  if (!step) return null;
2427
2253
  if (typeof step.target !== "object") return null;
2428
2254
  const description = step.target.description;
2429
2255
  return typeof description === "string" ? description : null;
2430
2256
  }, [step]);
2431
- const descriptionId = (0, import_react13.useMemo)(() => {
2257
+ const descriptionId = _react.useMemo.call(void 0, () => {
2432
2258
  if (!step || !targetDescription) return void 0;
2433
2259
  return `tour-step-${sanitizeForId(step.id)}-description`;
2434
2260
  }, [step, targetDescription]);
2435
- const combinedAriaDescribedBy = (0, import_react13.useMemo)(() => {
2261
+ const combinedAriaDescribedBy = _react.useMemo.call(void 0, () => {
2436
2262
  const parts = [fallbackAriaDescribedBy, descriptionId].filter(Boolean);
2437
2263
  return parts.length > 0 ? parts.join(" ") : void 0;
2438
2264
  }, [descriptionId, fallbackAriaDescribedBy]);
@@ -2444,10 +2270,10 @@ var useHudDescription = (options) => {
2444
2270
  };
2445
2271
 
2446
2272
  // src/hooks/useHudShortcuts.ts
2447
- var import_react15 = require("react");
2273
+
2448
2274
 
2449
2275
  // src/hooks/useTourControls.ts
2450
- var import_react14 = require("react");
2276
+
2451
2277
  var hasManualAdvance = (rules) => rules.some((rule) => rule.type === "manual");
2452
2278
  var didPreviousAdvanceViaRoute = (rules) => rules.some((rule) => rule.type === "route");
2453
2279
  var useTourControls = () => {
@@ -2462,7 +2288,7 @@ var useTourControls = () => {
2462
2288
  flows,
2463
2289
  activeStep
2464
2290
  } = tour;
2465
- const computed = (0, import_react14.useMemo)(() => {
2291
+ const computed = _react.useMemo.call(void 0, () => {
2466
2292
  if (!state || state.status !== "running" || !activeStep) {
2467
2293
  return {
2468
2294
  isActive: false,
@@ -2475,16 +2301,16 @@ var useTourControls = () => {
2475
2301
  };
2476
2302
  }
2477
2303
  const definition = activeFlowId ? flows.get(activeFlowId) : null;
2478
- const totalSteps = definition?.steps.length ?? 0;
2304
+ const totalSteps = _nullishCoalesce(_optionalChain([definition, 'optionalAccess', _87 => _87.steps, 'access', _88 => _88.length]), () => ( 0));
2479
2305
  const stepIndex = state.stepIndex;
2480
2306
  const isFirst2 = stepIndex <= 0;
2481
2307
  const isLast2 = totalSteps > 0 && stepIndex >= totalSteps - 1;
2482
2308
  const previousStep = !definition || stepIndex <= 0 ? null : definition.steps[stepIndex - 1];
2483
- const advanceRules = activeStep.advance ?? [];
2309
+ const advanceRules = _nullishCoalesce(activeStep.advance, () => ( []));
2484
2310
  const hasAdvanceRules = advanceRules.length > 0;
2485
- const previousAdvanceRules = previousStep?.advance ?? [];
2486
- const backControlState = activeStep.controls?.back ?? "auto";
2487
- const nextControlState = activeStep.controls?.next ?? "auto";
2311
+ const previousAdvanceRules = _nullishCoalesce(_optionalChain([previousStep, 'optionalAccess', _89 => _89.advance]), () => ( []));
2312
+ const backControlState = _nullishCoalesce(_optionalChain([activeStep, 'access', _90 => _90.controls, 'optionalAccess', _91 => _91.back]), () => ( "auto"));
2313
+ const nextControlState = _nullishCoalesce(_optionalChain([activeStep, 'access', _92 => _92.controls, 'optionalAccess', _93 => _93.next]), () => ( "auto"));
2488
2314
  const showBackButton2 = backControlState !== "hidden" && !isFirst2 && !didPreviousAdvanceViaRoute(previousAdvanceRules);
2489
2315
  const backDisabled2 = backControlState === "disabled";
2490
2316
  const manualAdvancePresent = hasManualAdvance(advanceRules);
@@ -2511,11 +2337,11 @@ var useTourControls = () => {
2511
2337
  } = computed;
2512
2338
  const canGoBack = showBackButton && !backDisabled;
2513
2339
  const canGoNext = showNextButton && !nextDisabled;
2514
- const goBack = (0, import_react14.useCallback)(() => {
2340
+ const goBack = _react.useCallback.call(void 0, () => {
2515
2341
  if (!canGoBack) return;
2516
2342
  back();
2517
2343
  }, [back, canGoBack]);
2518
- const goNext = (0, import_react14.useCallback)(() => {
2344
+ const goNext = _react.useCallback.call(void 0, () => {
2519
2345
  if (!canGoNext) return;
2520
2346
  if (isLast) {
2521
2347
  complete();
@@ -2523,7 +2349,7 @@ var useTourControls = () => {
2523
2349
  next();
2524
2350
  }
2525
2351
  }, [canGoNext, complete, isLast, next]);
2526
- return (0, import_react14.useMemo)(
2352
+ return _react.useMemo.call(void 0,
2527
2353
  () => ({
2528
2354
  showBackButton,
2529
2355
  backDisabled,
@@ -2564,12 +2390,12 @@ var isInteractiveElement = (node) => {
2564
2390
  return Boolean(node.closest(interactiveSelector));
2565
2391
  };
2566
2392
  var useHudShortcuts = (target, options) => {
2567
- const enabled = options?.enabled ?? true;
2568
- const escapeEnabled = options?.escape ?? true;
2393
+ const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _94 => _94.enabled]), () => ( true));
2394
+ const escapeEnabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _95 => _95.escape]), () => ( true));
2569
2395
  const { state } = useTour();
2570
2396
  const { cancel, canGoBack, goBack, canGoNext, goNext, isActive } = useTourControls();
2571
- (0, import_react15.useEffect)(() => {
2572
- if (!isBrowser) return void 0;
2397
+ _react.useEffect.call(void 0, () => {
2398
+ if (!_chunkD5LQLRSUcjs.isBrowser) return void 0;
2573
2399
  if (!enabled) return void 0;
2574
2400
  if (!target) return void 0;
2575
2401
  if (!state || state.status !== "running") return void 0;
@@ -2632,14 +2458,14 @@ var useHudShortcuts = (target, options) => {
2632
2458
  };
2633
2459
 
2634
2460
  // src/hooks/useTourHud.ts
2635
- var import_react18 = require("react");
2461
+
2636
2462
 
2637
2463
  // src/hooks/useBodyScrollLock.ts
2638
- var import_react16 = require("react");
2464
+
2639
2465
  var lockCount = 0;
2640
2466
  var previousOverflow = null;
2641
2467
  var acquireLock = () => {
2642
- if (!isBrowser) return;
2468
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
2643
2469
  if (lockCount === 0) {
2644
2470
  previousOverflow = document.body.style.overflow;
2645
2471
  document.body.style.overflow = "hidden";
@@ -2647,16 +2473,16 @@ var acquireLock = () => {
2647
2473
  lockCount += 1;
2648
2474
  };
2649
2475
  var releaseLock = () => {
2650
- if (!isBrowser) return;
2476
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
2651
2477
  if (lockCount === 0) return;
2652
2478
  lockCount -= 1;
2653
2479
  if (lockCount === 0) {
2654
- document.body.style.overflow = previousOverflow ?? "";
2480
+ document.body.style.overflow = _nullishCoalesce(previousOverflow, () => ( ""));
2655
2481
  previousOverflow = null;
2656
2482
  }
2657
2483
  };
2658
2484
  var useBodyScrollLock = (enabled) => {
2659
- (0, import_react16.useEffect)(() => {
2485
+ _react.useEffect.call(void 0, () => {
2660
2486
  if (!enabled) return;
2661
2487
  acquireLock();
2662
2488
  return () => {
@@ -2666,7 +2492,7 @@ var useBodyScrollLock = (enabled) => {
2666
2492
  };
2667
2493
 
2668
2494
  // src/hooks/useHudTargetIssue.ts
2669
- var import_react17 = require("react");
2495
+
2670
2496
  var deriveTargetIssue = (params) => {
2671
2497
  const { target, labels } = params;
2672
2498
  if (target.isScreen) return null;
@@ -2698,18 +2524,18 @@ var deriveTargetIssue = (params) => {
2698
2524
  };
2699
2525
  var useHudTargetIssue = (target, options) => {
2700
2526
  const labels = useTourLabels();
2701
- const delayMs = Math.max(0, options?.delayMs ?? 500);
2702
- const [armed, setArmed] = (0, import_react17.useState)(false);
2703
- const rawIssue = (0, import_react17.useMemo)(
2527
+ const delayMs = Math.max(0, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _96 => _96.delayMs]), () => ( 500)));
2528
+ const [armed, setArmed] = _react.useState.call(void 0, false);
2529
+ const rawIssue = _react.useMemo.call(void 0,
2704
2530
  () => deriveTargetIssue({ target, labels }),
2705
2531
  [target.isScreen, target.rectSource, target.status, target.visibility, labels]
2706
2532
  );
2707
- (0, import_react17.useEffect)(() => {
2533
+ _react.useEffect.call(void 0, () => {
2708
2534
  if (!rawIssue) {
2709
2535
  setArmed(false);
2710
2536
  return;
2711
2537
  }
2712
- if (!isBrowser) {
2538
+ if (!_chunkD5LQLRSUcjs.isBrowser) {
2713
2539
  setArmed(true);
2714
2540
  return;
2715
2541
  }
@@ -2718,7 +2544,7 @@ var useHudTargetIssue = (target, options) => {
2718
2544
  setArmed(false);
2719
2545
  globalThis.clearTimeout(timeoutId);
2720
2546
  };
2721
- }, [delayMs, rawIssue?.type]);
2547
+ }, [delayMs, _optionalChain([rawIssue, 'optionalAccess', _97 => _97.type])]);
2722
2548
  return {
2723
2549
  issue: armed ? rawIssue : null,
2724
2550
  rawIssue
@@ -2734,24 +2560,24 @@ var useTourHud = (options = {}) => {
2734
2560
  overlayRadius,
2735
2561
  bodyScrollLock = DEFAULT_BODY_SCROLL_LOCK
2736
2562
  } = options;
2737
- const shortcuts = options.shortcuts ?? DEFAULT_SHORTCUTS;
2563
+ const shortcuts = _nullishCoalesce(options.shortcuts, () => ( DEFAULT_SHORTCUTS));
2738
2564
  const { backdropInteraction, lockBodyScroll } = useTour();
2739
2565
  const hudState = useHudState();
2740
2566
  const disableDefaultHud = hudState.hudRenderMode === "none";
2741
- const [popoverNode, setPopoverNode] = (0, import_react18.useState)(null);
2742
- const popoverOptions = hudState.flowHudOptions?.popover;
2567
+ const [popoverNode, setPopoverNode] = _react.useState.call(void 0, null);
2568
+ const popoverOptions = _optionalChain([hudState, 'access', _98 => _98.flowHudOptions, 'optionalAccess', _99 => _99.popover]);
2743
2569
  const description = useHudDescription({
2744
2570
  step: hudState.runningStep,
2745
- fallbackAriaDescribedBy: popoverOptions?.ariaDescribedBy
2571
+ fallbackAriaDescribedBy: _optionalChain([popoverOptions, 'optionalAccess', _100 => _100.ariaDescribedBy])
2746
2572
  });
2747
2573
  const targetIssue = useHudTargetIssue(hudState.hudTarget);
2748
2574
  const shouldLockBodyScroll = Boolean(
2749
- bodyScrollLock && (hudState.flowHudOptions?.behavior?.lockBodyScroll ?? lockBodyScroll) && hudState.focusTrapActive
2575
+ bodyScrollLock && (_nullishCoalesce(_optionalChain([hudState, 'access', _101 => _101.flowHudOptions, 'optionalAccess', _102 => _102.behavior, 'optionalAccess', _103 => _103.lockBodyScroll]), () => ( lockBodyScroll))) && hudState.focusTrapActive
2750
2576
  );
2751
2577
  useBodyScrollLock(shouldLockBodyScroll);
2752
2578
  const shortcutOptions = typeof shortcuts === "object" ? shortcuts : {};
2753
2579
  const shortcutsEnabled = Boolean(
2754
- (typeof shortcuts === "boolean" ? shortcuts : shortcuts.enabled ?? true) && hudState.shouldRender
2580
+ (typeof shortcuts === "boolean" ? shortcuts : _nullishCoalesce(shortcuts.enabled, () => ( true))) && hudState.shouldRender
2755
2581
  );
2756
2582
  useHudShortcuts(shortcutsEnabled ? hudState.hudTarget : null, {
2757
2583
  ...shortcutOptions,
@@ -2760,40 +2586,40 @@ var useTourHud = (options = {}) => {
2760
2586
  const overlay = {
2761
2587
  padding: overlayPadding,
2762
2588
  radius: overlayRadius,
2763
- interactionMode: hudState.flowHudOptions?.backdrop?.interaction ?? backdropInteraction
2589
+ interactionMode: _nullishCoalesce(_optionalChain([hudState, 'access', _104 => _104.flowHudOptions, 'optionalAccess', _105 => _105.backdrop, 'optionalAccess', _106 => _106.interaction]), () => ( backdropInteraction))
2764
2590
  };
2765
- const popover = (0, import_react18.useMemo)(() => {
2591
+ const popover = _react.useMemo.call(void 0, () => {
2766
2592
  return {
2767
- offset: popoverOptions?.offset ?? 32,
2768
- role: popoverOptions?.role ?? "dialog",
2769
- ariaLabel: popoverOptions?.ariaLabel,
2770
- ariaDescribedBy: popoverOptions?.ariaDescribedBy,
2771
- ariaModal: popoverOptions?.ariaModal ?? false,
2772
- width: popoverOptions?.width,
2773
- maxWidth: popoverOptions?.maxWidth,
2774
- placement: hudState.runningStep?.placement
2593
+ offset: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _107 => _107.offset]), () => ( 32)),
2594
+ role: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _108 => _108.role]), () => ( "dialog")),
2595
+ ariaLabel: _optionalChain([popoverOptions, 'optionalAccess', _109 => _109.ariaLabel]),
2596
+ ariaDescribedBy: _optionalChain([popoverOptions, 'optionalAccess', _110 => _110.ariaDescribedBy]),
2597
+ ariaModal: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _111 => _111.ariaModal]), () => ( false)),
2598
+ width: _optionalChain([popoverOptions, 'optionalAccess', _112 => _112.width]),
2599
+ maxWidth: _optionalChain([popoverOptions, 'optionalAccess', _113 => _113.maxWidth]),
2600
+ placement: _optionalChain([hudState, 'access', _114 => _114.runningStep, 'optionalAccess', _115 => _115.placement])
2775
2601
  };
2776
- }, [hudState.runningStep?.placement, popoverOptions]);
2777
- const descriptionResult = (0, import_react18.useMemo)(() => {
2602
+ }, [_optionalChain([hudState, 'access', _116 => _116.runningStep, 'optionalAccess', _117 => _117.placement]), popoverOptions]);
2603
+ const descriptionResult = _react.useMemo.call(void 0, () => {
2778
2604
  return {
2779
2605
  ...description,
2780
2606
  text: description.targetDescription
2781
2607
  };
2782
2608
  }, [description]);
2783
- const focusManager = (0, import_react18.useMemo)(
2609
+ const focusManager = _react.useMemo.call(void 0,
2784
2610
  () => ({
2785
2611
  active: hudState.focusTrapActive,
2786
2612
  target: hudState.hudTarget,
2787
2613
  popoverNode,
2788
2614
  setPopoverNode,
2789
- guardElementFocusRing: hudState.flowHudOptions?.guardElementFocusRing
2615
+ guardElementFocusRing: _optionalChain([hudState, 'access', _118 => _118.flowHudOptions, 'optionalAccess', _119 => _119.guardElementFocusRing])
2790
2616
  }),
2791
2617
  [
2792
2618
  hudState.focusTrapActive,
2793
2619
  hudState.hudTarget,
2794
2620
  popoverNode,
2795
2621
  setPopoverNode,
2796
- hudState.flowHudOptions?.guardElementFocusRing
2622
+ _optionalChain([hudState, 'access', _120 => _120.flowHudOptions, 'optionalAccess', _121 => _121.guardElementFocusRing])
2797
2623
  ]
2798
2624
  );
2799
2625
  return {
@@ -2810,7 +2636,7 @@ var useTourHud = (options = {}) => {
2810
2636
  };
2811
2637
 
2812
2638
  // src/hooks/useTourOverlay.ts
2813
- var import_react19 = require("react");
2639
+
2814
2640
  var DEFAULT_PADDING = 12;
2815
2641
  var DEFAULT_RADIUS = 12;
2816
2642
  var DEFAULT_EDGE_BUFFER = 0;
@@ -2823,10 +2649,10 @@ var useTourOverlay = (options) => {
2823
2649
  interactionMode = "passthrough",
2824
2650
  isInGracePeriod = false
2825
2651
  } = options;
2826
- const hasShownRef = (0, import_react19.useRef)(false);
2827
- const lastReadyTargetRef = (0, import_react19.useRef)(null);
2828
- (0, import_react19.useEffect)(() => {
2829
- if (!isBrowser) return;
2652
+ const hasShownRef = _react.useRef.call(void 0, false);
2653
+ const lastReadyTargetRef = _react.useRef.call(void 0, null);
2654
+ _react.useEffect.call(void 0, () => {
2655
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
2830
2656
  if (target.status === "ready") {
2831
2657
  hasShownRef.current = true;
2832
2658
  lastReadyTargetRef.current = {
@@ -2835,17 +2661,17 @@ var useTourOverlay = (options) => {
2835
2661
  };
2836
2662
  return;
2837
2663
  }
2838
- if (target.status === "idle") {
2664
+ if (target.status === "idle" && !isInGracePeriod) {
2839
2665
  hasShownRef.current = false;
2840
2666
  lastReadyTargetRef.current = null;
2841
2667
  }
2842
- }, [target]);
2843
- const viewport = getViewportRect();
2668
+ }, [target, isInGracePeriod]);
2669
+ const viewport = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
2844
2670
  const cachedTarget = lastReadyTargetRef.current;
2845
2671
  const highlightTarget = target.status === "ready" ? target : cachedTarget;
2846
- const resolvedRect = highlightTarget?.rect ?? target.rect;
2847
- const resolvedIsScreen = highlightTarget?.isScreen ?? target.isScreen;
2848
- const expandedRect = resolvedIsScreen || !resolvedRect ? viewport : expandRect(resolvedRect, padding);
2672
+ const resolvedRect = _nullishCoalesce(_optionalChain([highlightTarget, 'optionalAccess', _122 => _122.rect]), () => ( target.rect));
2673
+ const resolvedIsScreen = _nullishCoalesce(_optionalChain([highlightTarget, 'optionalAccess', _123 => _123.isScreen]), () => ( target.isScreen));
2674
+ const expandedRect = resolvedIsScreen || !resolvedRect ? viewport : _chunkD5LQLRSUcjs.expandRect.call(void 0, resolvedRect, padding);
2849
2675
  const safeBuffer = Math.max(0, edgeBuffer);
2850
2676
  const insetTop = expandedRect.top <= 0 ? Math.min(safeBuffer, Math.max(0, expandedRect.height) / 2) : 0;
2851
2677
  const insetLeft = expandedRect.left <= 0 ? Math.min(safeBuffer, Math.max(0, expandedRect.width) / 2) : 0;
@@ -2875,15 +2701,15 @@ var useTourOverlay = (options) => {
2875
2701
  height: highlightHeight,
2876
2702
  radius: highlightRadius
2877
2703
  } : null;
2878
- const maskCapable = (0, import_react19.useMemo)(() => supportsMasking(), []);
2704
+ const maskCapable = _react.useMemo.call(void 0, () => _chunkD5LQLRSUcjs.supportsMasking.call(void 0, ), []);
2879
2705
  const isActive = target.status === "ready" || target.status === "resolving" && cachedTarget !== null || isInGracePeriod;
2880
2706
  const shouldMask = maskCapable && isActive;
2881
- const maskId = (0, import_react19.useMemo)(
2707
+ const maskId = _react.useMemo.call(void 0,
2882
2708
  () => `tour-overlay-mask-${Math.random().toString(36).slice(2, 10)}`,
2883
2709
  []
2884
2710
  );
2885
2711
  const maskUrl = shouldMask ? `url(#${maskId})` : void 0;
2886
- const fallbackSegments = (0, import_react19.useMemo)(() => {
2712
+ const fallbackSegments = _react.useMemo.call(void 0, () => {
2887
2713
  if (!isActive || shouldMask || !hasHighlightBounds || !highlightRect) {
2888
2714
  return null;
2889
2715
  }
@@ -2936,7 +2762,7 @@ var useTourOverlay = (options) => {
2936
2762
  viewport.height,
2937
2763
  viewport.width
2938
2764
  ]);
2939
- const blockerSegments = (0, import_react19.useMemo)(() => {
2765
+ const blockerSegments = _react.useMemo.call(void 0, () => {
2940
2766
  if (interactionMode !== "block") {
2941
2767
  return null;
2942
2768
  }
@@ -3006,7 +2832,7 @@ var useTourOverlay = (options) => {
3006
2832
  rect: highlightRect,
3007
2833
  centerX: highlightCenterX,
3008
2834
  centerY: highlightCenterY,
3009
- target: highlightTarget ?? null,
2835
+ target: _nullishCoalesce(highlightTarget, () => ( null)),
3010
2836
  isScreen: resolvedIsScreen
3011
2837
  },
3012
2838
  shouldMask,
@@ -3024,7 +2850,7 @@ var DEFAULT_ENABLED = true;
3024
2850
  var useTourFocusDominance = (options = {}) => {
3025
2851
  const { enabled = DEFAULT_ENABLED } = options;
3026
2852
  const { state } = useTour();
3027
- const isRunning = state?.status === "running";
2853
+ const isRunning = _optionalChain([state, 'optionalAccess', _124 => _124.status]) === "running";
3028
2854
  const active = Boolean(enabled && isRunning);
3029
2855
  return {
3030
2856
  active,
@@ -3066,7 +2892,7 @@ var waitForDom = () => new Promise(
3066
2892
  );
3067
2893
 
3068
2894
  // src/hooks/useRadixTourDialog.ts
3069
- var import_react20 = require("react");
2895
+
3070
2896
  var resolveAutoOpen2 = (config) => {
3071
2897
  if (!config) return { onEnter: true, onResume: true };
3072
2898
  const { autoOpen } = config;
@@ -3075,8 +2901,8 @@ var resolveAutoOpen2 = (config) => {
3075
2901
  return { onEnter: true, onResume: true };
3076
2902
  }
3077
2903
  return {
3078
- onEnter: autoOpen.onEnter ?? true,
3079
- onResume: autoOpen.onResume ?? true
2904
+ onEnter: _nullishCoalesce(autoOpen.onEnter, () => ( true)),
2905
+ onResume: _nullishCoalesce(autoOpen.onResume, () => ( true))
3080
2906
  };
3081
2907
  };
3082
2908
  var useRadixTourDialog = (params) => {
@@ -3084,27 +2910,27 @@ var useRadixTourDialog = (params) => {
3084
2910
  const { activeFlowId, state, flows, goToStep, events } = useTour();
3085
2911
  const registry = useDialogRegistryOptional();
3086
2912
  const { suspendExternalFocusTrap } = useTourFocusDominance();
3087
- const [internalOpen, setInternalOpen] = (0, import_react20.useState)(false);
3088
- const lastStepIndexRef = (0, import_react20.useRef)(-1);
3089
- const isResumeRef = (0, import_react20.useRef)(false);
2913
+ const [internalOpen, setInternalOpen] = _react.useState.call(void 0, false);
2914
+ const lastStepIndexRef = _react.useRef.call(void 0, -1);
2915
+ const isResumeRef = _react.useRef.call(void 0, false);
3090
2916
  const flow = activeFlowId ? flows.get(activeFlowId) : void 0;
3091
- const dialogConfig = flow?.dialogs?.[dialogId];
2917
+ const dialogConfig = _optionalChain([flow, 'optionalAccess', _125 => _125.dialogs, 'optionalAccess', _126 => _126[dialogId]]);
3092
2918
  const currentStep = flow && state && state.stepIndex >= 0 ? flow.steps[state.stepIndex] : void 0;
3093
- const isStepActive = currentStep?.dialogId === dialogId;
2919
+ const isStepActive = _optionalChain([currentStep, 'optionalAccess', _127 => _127.dialogId]) === dialogId;
3094
2920
  const autoOpenConfig = resolveAutoOpen2(dialogConfig);
3095
- const autoClose = dialogConfig?.autoClose ?? "differentDialog";
3096
- const shouldBeOpen = (0, import_react20.useMemo)(() => {
2921
+ const autoClose = _nullishCoalesce(_optionalChain([dialogConfig, 'optionalAccess', _128 => _128.autoClose]), () => ( "differentDialog"));
2922
+ const shouldBeOpen = _react.useMemo.call(void 0, () => {
3097
2923
  if (!isStepActive) return false;
3098
2924
  return true;
3099
2925
  }, [isStepActive]);
3100
- (0, import_react20.useEffect)(() => {
2926
+ _react.useEffect.call(void 0, () => {
3101
2927
  if (!events) return;
3102
2928
  const unsubscribe = events.on("flowResume", () => {
3103
2929
  isResumeRef.current = true;
3104
2930
  });
3105
2931
  return unsubscribe;
3106
2932
  }, [events]);
3107
- (0, import_react20.useEffect)(() => {
2933
+ _react.useEffect.call(void 0, () => {
3108
2934
  if (!state || state.status !== "running") return;
3109
2935
  if (!flow) return;
3110
2936
  const currentStepIndex = state.stepIndex;
@@ -3124,7 +2950,7 @@ var useRadixTourDialog = (params) => {
3124
2950
  if (previousStepIndex === currentStepIndex) return;
3125
2951
  lastStepIndexRef.current = currentStepIndex;
3126
2952
  const previousStep = previousStepIndex >= 0 ? flow.steps[previousStepIndex] : void 0;
3127
- const wasActive = previousStep?.dialogId === dialogId;
2953
+ const wasActive = _optionalChain([previousStep, 'optionalAccess', _129 => _129.dialogId]) === dialogId;
3128
2954
  if (isStepActive && !wasActive) {
3129
2955
  const shouldAutoOpen = wasResume ? autoOpenConfig.onResume : autoOpenConfig.onEnter;
3130
2956
  if (shouldAutoOpen) {
@@ -3145,7 +2971,7 @@ var useRadixTourDialog = (params) => {
3145
2971
  autoOpenConfig.onResume,
3146
2972
  autoClose
3147
2973
  ]);
3148
- (0, import_react20.useEffect)(() => {
2974
+ _react.useEffect.call(void 0, () => {
3149
2975
  if (!events) return;
3150
2976
  const unsubscribeEnter = events.on("stepEnter", (payload) => {
3151
2977
  const step = payload.currentStep;
@@ -3162,7 +2988,7 @@ var useRadixTourDialog = (params) => {
3162
2988
  const step = payload.previousStep;
3163
2989
  if (step.dialogId !== dialogId) return;
3164
2990
  const nextStep = payload.currentStep;
3165
- if (nextStep?.dialogId === dialogId) {
2991
+ if (_optionalChain([nextStep, 'optionalAccess', _130 => _130.dialogId]) === dialogId) {
3166
2992
  return;
3167
2993
  }
3168
2994
  if (autoClose === "always" || autoClose === "differentDialog") {
@@ -3176,12 +3002,12 @@ var useRadixTourDialog = (params) => {
3176
3002
  unsubscribeExit();
3177
3003
  };
3178
3004
  }, [events, dialogId, autoOpenConfig, autoClose]);
3179
- const handleDismiss = (0, import_react20.useCallback)(() => {
3005
+ const handleDismiss = _react.useCallback.call(void 0, () => {
3180
3006
  if (!dialogConfig) return;
3181
3007
  setInternalOpen(false);
3182
3008
  goToStep(dialogConfig.onDismissGoToStepId);
3183
3009
  }, [dialogConfig, goToStep]);
3184
- const onOpenChange = (0, import_react20.useCallback)(
3010
+ const onOpenChange = _react.useCallback.call(void 0,
3185
3011
  (open) => {
3186
3012
  if (open) {
3187
3013
  setInternalOpen(true);
@@ -3195,7 +3021,7 @@ var useRadixTourDialog = (params) => {
3195
3021
  },
3196
3022
  [isStepActive, dialogConfig, handleDismiss]
3197
3023
  );
3198
- (0, import_react20.useEffect)(() => {
3024
+ _react.useEffect.call(void 0, () => {
3199
3025
  if (!registry) return;
3200
3026
  const controller = {
3201
3027
  open: () => setInternalOpen(true),
@@ -3205,7 +3031,7 @@ var useRadixTourDialog = (params) => {
3205
3031
  registry.register(dialogId, controller);
3206
3032
  return () => registry.unregister(dialogId);
3207
3033
  }, [registry, dialogId, internalOpen]);
3208
- const preventDismiss = (0, import_react20.useCallback)(
3034
+ const preventDismiss = _react.useCallback.call(void 0,
3209
3035
  (event) => {
3210
3036
  if (suspendExternalFocusTrap) {
3211
3037
  event.preventDefault();
@@ -3213,7 +3039,7 @@ var useRadixTourDialog = (params) => {
3213
3039
  },
3214
3040
  [suspendExternalFocusTrap]
3215
3041
  );
3216
- const handleEscapeKeyDown = (0, import_react20.useCallback)(
3042
+ const handleEscapeKeyDown = _react.useCallback.call(void 0,
3217
3043
  (event) => {
3218
3044
  if (isStepActive && dialogConfig) {
3219
3045
  event.preventDefault();
@@ -3222,7 +3048,7 @@ var useRadixTourDialog = (params) => {
3222
3048
  },
3223
3049
  [isStepActive, dialogConfig, handleDismiss]
3224
3050
  );
3225
- const handleInteractOutside = (0, import_react20.useCallback)(
3051
+ const handleInteractOutside = _react.useCallback.call(void 0,
3226
3052
  (event) => {
3227
3053
  if (suspendExternalFocusTrap) {
3228
3054
  event.preventDefault();
@@ -3254,16 +3080,16 @@ var useRadixTourDialog = (params) => {
3254
3080
  };
3255
3081
 
3256
3082
  // src/hooks/useDelayAdvance.ts
3257
- var import_react21 = require("react");
3083
+
3258
3084
  var getTimestamp = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
3259
3085
  var useDelayAdvance = () => {
3260
3086
  const { delayInfo, activeStep, state } = useTour();
3261
- const [now, setNow] = (0, import_react21.useState)(() => getTimestamp());
3262
- (0, import_react21.useEffect)(() => {
3087
+ const [now, setNow] = _react.useState.call(void 0, () => getTimestamp());
3088
+ _react.useEffect.call(void 0, () => {
3263
3089
  if (!delayInfo) return;
3264
3090
  if (!activeStep || activeStep.id !== delayInfo.stepId) return;
3265
3091
  if (!state || state.status !== "running") return;
3266
- if (!isBrowser) return;
3092
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
3267
3093
  let frameId = null;
3268
3094
  const tick = () => {
3269
3095
  setNow(getTimestamp());
@@ -3276,14 +3102,14 @@ var useDelayAdvance = () => {
3276
3102
  }
3277
3103
  };
3278
3104
  }, [delayInfo, activeStep, state]);
3279
- (0, import_react21.useEffect)(() => {
3105
+ _react.useEffect.call(void 0, () => {
3280
3106
  if (!delayInfo) {
3281
3107
  setNow(getTimestamp());
3282
3108
  }
3283
3109
  }, [delayInfo]);
3284
- return (0, import_react21.useMemo)(() => {
3110
+ return _react.useMemo.call(void 0, () => {
3285
3111
  const matchingStep = !!delayInfo && !!activeStep && activeStep.id === delayInfo.stepId;
3286
- const isRunning = matchingStep && state?.status === "running";
3112
+ const isRunning = matchingStep && _optionalChain([state, 'optionalAccess', _131 => _131.status]) === "running";
3287
3113
  if (!delayInfo) {
3288
3114
  return {
3289
3115
  isActive: false,
@@ -3334,10 +3160,10 @@ var useDelayAdvance = () => {
3334
3160
  };
3335
3161
 
3336
3162
  // src/components/OverlayBackdrop.tsx
3337
- var import_react22 = require("react");
3338
- var import_react_dom = require("react-dom");
3339
- var import_react23 = require("motion/react");
3340
- var import_jsx_runtime4 = require("react/jsx-runtime");
3163
+
3164
+ var _reactdom = require('react-dom');
3165
+
3166
+
3341
3167
  var styles = {
3342
3168
  root: {
3343
3169
  position: "fixed",
@@ -3407,8 +3233,8 @@ var OverlayBackdrop = ({
3407
3233
  showInteractionBlocker = true,
3408
3234
  transitionsOverride
3409
3235
  }) => {
3410
- if (!isBrowser) return null;
3411
- const host = portalHost();
3236
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
3237
+ const host = _chunkD5LQLRSUcjs.portalHost.call(void 0, );
3412
3238
  if (!host) return null;
3413
3239
  const adapter = useAnimationAdapter();
3414
3240
  const {
@@ -3423,28 +3249,28 @@ var OverlayBackdrop = ({
3423
3249
  viewport
3424
3250
  } = overlay;
3425
3251
  const hasHighlightBounds = Boolean(highlight.rect);
3426
- const prevScreenTargetRef = (0, import_react22.useRef)(null);
3252
+ const prevScreenTargetRef = _react.useRef.call(void 0, null);
3427
3253
  const shouldSnapHighlight = prevScreenTargetRef.current === true && !highlight.isScreen && hasHighlightBounds;
3428
- (0, import_react22.useEffect)(() => {
3254
+ _react.useEffect.call(void 0, () => {
3429
3255
  prevScreenTargetRef.current = highlight.isScreen;
3430
3256
  }, [highlight.isScreen]);
3431
3257
  const resolvedBlur = typeof blurAmount === "number" ? `${blurAmount}px` : "0px";
3432
3258
  const defaultInsetShadow = "inset 0 0 0 2px rgba(56,189,248,0.4), inset 0 0 0 8px rgba(15,23,42,0.3)";
3433
3259
  const highlightAppearance = shadow ? { boxShadow: shadow } : { boxShadow: defaultInsetShadow };
3434
3260
  const { MotionDiv, MotionSvg, MotionDefs, MotionMask, MotionRect } = adapter.components;
3435
- const highlightTransition = transitionsOverride?.overlayHighlight ?? adapter.transitions.overlayHighlight ?? DEFAULT_HIGHLIGHT_TRANSITION;
3261
+ const highlightTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _132 => _132.overlayHighlight]), () => ( adapter.transitions.overlayHighlight)), () => ( DEFAULT_HIGHLIGHT_TRANSITION));
3436
3262
  const snapTransition = { type: "tween", duration: 0 };
3437
3263
  const resolvedHighlightTransition = shouldSnapHighlight ? snapTransition : highlightTransition;
3438
- const overlayTransition = transitionsOverride?.overlayFade ?? adapter.transitions.overlayFade ?? DEFAULT_OVERLAY_TRANSITION;
3439
- const highlightCollapseTransition = highlight.isScreen ? snapTransition : transitionsOverride?.overlayHighlightCollapse ?? DEFAULT_HIGHLIGHT_COLLAPSE_TRANSITION;
3264
+ const overlayTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _133 => _133.overlayFade]), () => ( adapter.transitions.overlayFade)), () => ( DEFAULT_OVERLAY_TRANSITION));
3265
+ const highlightCollapseTransition = highlight.isScreen ? snapTransition : _nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _134 => _134.overlayHighlightCollapse]), () => ( DEFAULT_HIGHLIGHT_COLLAPSE_TRANSITION));
3440
3266
  const highlightRectTransition = hasHighlightBounds ? resolvedHighlightTransition : highlightCollapseTransition;
3441
3267
  const highlightRectAnimation = shouldMask ? {
3442
- x: highlight.rect?.left ?? highlight.centerX,
3443
- y: highlight.rect?.top ?? highlight.centerY,
3444
- width: highlight.rect?.width ?? 0,
3445
- height: highlight.rect?.height ?? 0,
3446
- rx: highlight.rect?.radius ?? 0,
3447
- ry: highlight.rect?.radius ?? 0
3268
+ x: _nullishCoalesce(_optionalChain([highlight, 'access', _135 => _135.rect, 'optionalAccess', _136 => _136.left]), () => ( highlight.centerX)),
3269
+ y: _nullishCoalesce(_optionalChain([highlight, 'access', _137 => _137.rect, 'optionalAccess', _138 => _138.top]), () => ( highlight.centerY)),
3270
+ width: _nullishCoalesce(_optionalChain([highlight, 'access', _139 => _139.rect, 'optionalAccess', _140 => _140.width]), () => ( 0)),
3271
+ height: _nullishCoalesce(_optionalChain([highlight, 'access', _141 => _141.rect, 'optionalAccess', _142 => _142.height]), () => ( 0)),
3272
+ rx: _nullishCoalesce(_optionalChain([highlight, 'access', _143 => _143.rect, 'optionalAccess', _144 => _144.radius]), () => ( 0)),
3273
+ ry: _nullishCoalesce(_optionalChain([highlight, 'access', _145 => _145.rect, 'optionalAccess', _146 => _146.radius]), () => ( 0))
3448
3274
  } : {
3449
3275
  x: highlight.centerX,
3450
3276
  y: highlight.centerY,
@@ -3456,9 +3282,9 @@ var OverlayBackdrop = ({
3456
3282
  const highlightRingAnimation = hasHighlightBounds ? {
3457
3283
  top: highlight.centerY,
3458
3284
  left: highlight.centerX,
3459
- width: highlight.rect?.width ?? 0,
3460
- height: highlight.rect?.height ?? 0,
3461
- borderRadius: highlight.rect?.radius ?? 0,
3285
+ width: _nullishCoalesce(_optionalChain([highlight, 'access', _147 => _147.rect, 'optionalAccess', _148 => _148.width]), () => ( 0)),
3286
+ height: _nullishCoalesce(_optionalChain([highlight, 'access', _149 => _149.rect, 'optionalAccess', _150 => _150.height]), () => ( 0)),
3287
+ borderRadius: _nullishCoalesce(_optionalChain([highlight, 'access', _151 => _151.rect, 'optionalAccess', _152 => _152.radius]), () => ( 0)),
3462
3288
  opacity: 1,
3463
3289
  transform: "translate(-50%, -50%)"
3464
3290
  } : {
@@ -3484,8 +3310,8 @@ var OverlayBackdrop = ({
3484
3310
  if (color) {
3485
3311
  overlayStyle.backgroundColor = color;
3486
3312
  }
3487
- return (0, import_react_dom.createPortal)(
3488
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3313
+ return _reactdom.createPortal.call(void 0,
3314
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3489
3315
  MotionDiv,
3490
3316
  {
3491
3317
  className: rootClassName,
@@ -3493,7 +3319,7 @@ var OverlayBackdrop = ({
3493
3319
  "aria-hidden": ariaHidden,
3494
3320
  "data-tour-overlay": "",
3495
3321
  children: [
3496
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.AnimatePresence, { mode: "popLayout", children: shouldMask ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3322
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react3.AnimatePresence, { mode: "popLayout", children: shouldMask ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3497
3323
  MotionSvg,
3498
3324
  {
3499
3325
  width: "0",
@@ -3505,10 +3331,10 @@ var OverlayBackdrop = ({
3505
3331
  animate: { opacity: 1 },
3506
3332
  exit: { opacity: 0 },
3507
3333
  transition: overlayTransition,
3508
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MotionDefs, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3334
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MotionDefs, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3509
3335
  MotionMask,
3510
3336
  {
3511
- id: maskId ?? void 0,
3337
+ id: _nullishCoalesce(maskId, () => ( void 0)),
3512
3338
  initial: false,
3513
3339
  maskUnits: "userSpaceOnUse",
3514
3340
  maskContentUnits: "userSpaceOnUse",
@@ -3517,7 +3343,7 @@ var OverlayBackdrop = ({
3517
3343
  animate: { width: viewport.width, height: viewport.height },
3518
3344
  transition: highlightTransition,
3519
3345
  children: [
3520
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3346
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3521
3347
  MotionRect,
3522
3348
  {
3523
3349
  x: "0",
@@ -3533,7 +3359,7 @@ var OverlayBackdrop = ({
3533
3359
  exit: { opacity: 0 }
3534
3360
  }
3535
3361
  ),
3536
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3362
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3537
3363
  MotionRect,
3538
3364
  {
3539
3365
  initial: false,
@@ -3552,7 +3378,7 @@ var OverlayBackdrop = ({
3552
3378
  },
3553
3379
  "tour-mask"
3554
3380
  ) : null }),
3555
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.AnimatePresence, { mode: "popLayout", children: showBaseOverlay ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3381
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react3.AnimatePresence, { mode: "popLayout", children: showBaseOverlay ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3556
3382
  MotionDiv,
3557
3383
  {
3558
3384
  className: overlayClassName,
@@ -3561,7 +3387,7 @@ var OverlayBackdrop = ({
3561
3387
  ...styles.overlay,
3562
3388
  ...overlayStyle,
3563
3389
  zIndex,
3564
- backgroundColor: color ?? void 0
3390
+ backgroundColor: _nullishCoalesce(color, () => ( void 0))
3565
3391
  },
3566
3392
  initial: {
3567
3393
  opacity: 0,
@@ -3580,7 +3406,7 @@ var OverlayBackdrop = ({
3580
3406
  },
3581
3407
  "tour-overlay"
3582
3408
  ) : null }),
3583
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.AnimatePresence, { mode: "popLayout", children: fallbackSegments ? fallbackSegments.map((segment) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3409
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react3.AnimatePresence, { mode: "popLayout", children: fallbackSegments ? fallbackSegments.map((segment) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3584
3410
  MotionDiv,
3585
3411
  {
3586
3412
  className: segmentClassName,
@@ -3592,7 +3418,7 @@ var OverlayBackdrop = ({
3592
3418
  left: segment.left,
3593
3419
  width: segment.width,
3594
3420
  height: segment.height,
3595
- backgroundColor: color ?? void 0
3421
+ backgroundColor: _nullishCoalesce(color, () => ( void 0))
3596
3422
  },
3597
3423
  initial: {
3598
3424
  opacity: 0,
@@ -3610,13 +3436,13 @@ var OverlayBackdrop = ({
3610
3436
  },
3611
3437
  `tour-overlay-fallback-${segment.key}`
3612
3438
  )) : null }),
3613
- showInteractionBlocker && blockerSegments ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3439
+ showInteractionBlocker && blockerSegments ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3614
3440
  "div",
3615
3441
  {
3616
3442
  style: { ...styles.blockerContainer, zIndex },
3617
3443
  "data-tour-overlay-layer": "interaction-blocker",
3618
3444
  "aria-hidden": true,
3619
- children: blockerSegments.map((segment) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3445
+ children: blockerSegments.map((segment) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3620
3446
  "div",
3621
3447
  {
3622
3448
  style: {
@@ -3631,7 +3457,7 @@ var OverlayBackdrop = ({
3631
3457
  ))
3632
3458
  }
3633
3459
  ) : null,
3634
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react23.AnimatePresence, { mode: "popLayout", children: showHighlightRing && isActive && hasHighlightBounds ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3460
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react3.AnimatePresence, { mode: "popLayout", children: showHighlightRing && isActive && hasHighlightBounds ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3635
3461
  MotionDiv,
3636
3462
  {
3637
3463
  className: ringClassName,
@@ -3662,9 +3488,15 @@ var OverlayBackdrop = ({
3662
3488
  };
3663
3489
 
3664
3490
  // src/components/TourPopoverPortal.tsx
3665
- var import_react24 = require("react");
3666
- var import_react_dom2 = require("react-dom");
3667
- var import_dom13 = require("@floating-ui/dom");
3491
+
3492
+
3493
+
3494
+
3495
+
3496
+
3497
+
3498
+
3499
+ var _dom = require('@floating-ui/dom');
3668
3500
  var FLOATING_OFFSET = 8;
3669
3501
  var DOCKED_MARGIN = 24;
3670
3502
  var MOBILE_BREAKPOINT = 640;
@@ -3710,52 +3542,53 @@ var TourPopoverPortal = ({
3710
3542
  layoutId,
3711
3543
  containerComponent,
3712
3544
  contentComponent,
3713
- transitionsOverride
3545
+ transitionsOverride,
3546
+ isInGracePeriod = false
3714
3547
  }) => {
3715
- if (!isBrowser) return null;
3716
- const host = portalHost();
3548
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
3549
+ const host = _chunkD5LQLRSUcjs.portalHost.call(void 0, );
3717
3550
  if (!host) return null;
3718
3551
  const adapter = useAnimationAdapter();
3719
- const Container = containerComponent ?? adapter.components.MotionDiv;
3720
- const Content = contentComponent ?? adapter.components.MotionDiv;
3721
- const popoverEntranceTransition = transitionsOverride?.popoverEntrance ?? adapter.transitions.popoverEntrance ?? DEFAULT_POPOVER_ENTRANCE_TRANSITION;
3722
- const popoverExitTransition = transitionsOverride?.popoverExit ?? adapter.transitions.popoverExit ?? DEFAULT_POPOVER_EXIT_TRANSITION;
3723
- const popoverContentTransition = transitionsOverride?.popoverContent ?? adapter.transitions.popoverContent ?? DEFAULT_POPOVER_CONTENT_TRANSITION;
3552
+ const Container = _nullishCoalesce(containerComponent, () => ( adapter.components.MotionDiv));
3553
+ const Content = _nullishCoalesce(contentComponent, () => ( adapter.components.MotionDiv));
3554
+ const popoverEntranceTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _153 => _153.popoverEntrance]), () => ( adapter.transitions.popoverEntrance)), () => ( DEFAULT_POPOVER_ENTRANCE_TRANSITION));
3555
+ const popoverExitTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _154 => _154.popoverExit]), () => ( adapter.transitions.popoverExit)), () => ( DEFAULT_POPOVER_EXIT_TRANSITION));
3556
+ const popoverContentTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _155 => _155.popoverContent]), () => ( adapter.transitions.popoverContent)), () => ( DEFAULT_POPOVER_CONTENT_TRANSITION));
3724
3557
  const viewport = useViewportRect();
3725
3558
  const prefersMobileLayout = viewport.width <= MOBILE_BREAKPOINT || viewport.height <= MOBILE_HEIGHT_BREAKPOINT;
3726
- const prefersMobileRef = (0, import_react24.useRef)(prefersMobileLayout);
3727
- (0, import_react24.useEffect)(() => {
3559
+ const prefersMobileRef = _react.useRef.call(void 0, prefersMobileLayout);
3560
+ _react.useEffect.call(void 0, () => {
3728
3561
  prefersMobileRef.current = prefersMobileLayout;
3729
3562
  }, [prefersMobileLayout]);
3730
- const lastReadyTargetRef = (0, import_react24.useRef)(null);
3731
- (0, import_react24.useEffect)(() => {
3563
+ const lastReadyTargetRef = _react.useRef.call(void 0, null);
3564
+ _react.useEffect.call(void 0, () => {
3732
3565
  if (target.status === "ready" && target.rect) {
3733
3566
  lastReadyTargetRef.current = {
3734
3567
  rect: { ...target.rect },
3735
3568
  isScreen: target.isScreen
3736
3569
  };
3737
- } else if (target.status === "idle") {
3570
+ } else if (target.status === "idle" && !isInGracePeriod) {
3738
3571
  lastReadyTargetRef.current = null;
3739
3572
  }
3740
- }, [target.isScreen, target.rect, target.status]);
3573
+ }, [target.isScreen, target.rect, target.status, isInGracePeriod]);
3741
3574
  const cachedTarget = lastReadyTargetRef.current;
3742
- const resolvedRect = target.rect ?? target.lastResolvedRect ?? cachedTarget?.rect ?? null;
3743
- const resolvedIsScreen = target.status === "ready" ? target.isScreen : cachedTarget?.isScreen ?? target.isScreen;
3575
+ const resolvedRect = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(target.rect, () => ( target.lastResolvedRect)), () => ( _optionalChain([cachedTarget, 'optionalAccess', _156 => _156.rect]))), () => ( null));
3576
+ const resolvedIsScreen = target.status === "ready" ? target.isScreen : _nullishCoalesce(_optionalChain([cachedTarget, 'optionalAccess', _157 => _157.isScreen]), () => ( target.isScreen));
3744
3577
  const shouldHidePopover = !resolvedRect && !target.isScreen;
3745
- const fallbackRect = resolvedRect ?? viewport;
3578
+ const fallbackRect = _nullishCoalesce(resolvedRect, () => ( viewport));
3746
3579
  const fallbackIsScreen = resolvedIsScreen;
3747
- const [floatingSize, setFloatingSize] = (0, import_react24.useState)(null);
3580
+ const [floatingSize, setFloatingSize] = _react.useState.call(void 0, null);
3748
3581
  const clampVertical = (value) => Math.min(viewport.height - 24, Math.max(24, value));
3749
3582
  const clampHorizontal = (value) => Math.min(viewport.width - 24, Math.max(24, value));
3750
- const screenCenteredTop = viewport.height / 2 - (floatingSize?.height ?? 0) / 2;
3751
- const screenCenteredLeft = viewport.width / 2 - (floatingSize?.width ?? 0) / 2;
3752
- const floatingWidth = floatingSize?.width ?? 0;
3583
+ const screenCenteredTop = viewport.height / 2 - (_nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _158 => _158.height]), () => ( 0))) / 2;
3584
+ const screenCenteredLeft = viewport.width / 2 - (_nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _159 => _159.width]), () => ( 0))) / 2;
3585
+ const floatingWidth = _nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _160 => _160.width]), () => ( 0));
3753
3586
  const baseTop = fallbackIsScreen ? screenCenteredTop : fallbackRect.top + fallbackRect.height + offset;
3754
3587
  const top = fallbackIsScreen ? clampVertical(screenCenteredTop) : clampVertical(baseTop);
3755
3588
  const leftBase = fallbackIsScreen ? screenCenteredLeft : fallbackRect.left + fallbackRect.width / 2 - floatingWidth / 2;
3756
3589
  const left = clampHorizontal(leftBase);
3757
3590
  const fallbackTransform = "translate3d(0px, 0px, 0px)";
3758
- const fallbackPosition = (0, import_react24.useMemo)(
3591
+ const fallbackPosition = _react.useMemo.call(void 0,
3759
3592
  () => ({
3760
3593
  top,
3761
3594
  left,
@@ -3763,7 +3596,7 @@ var TourPopoverPortal = ({
3763
3596
  }),
3764
3597
  [fallbackTransform, left, top]
3765
3598
  );
3766
- const centerInitialPosition = (0, import_react24.useMemo)(
3599
+ const centerInitialPosition = _react.useMemo.call(void 0,
3767
3600
  () => ({
3768
3601
  top: viewport.height / 2,
3769
3602
  left: viewport.width / 2,
@@ -3771,24 +3604,24 @@ var TourPopoverPortal = ({
3771
3604
  }),
3772
3605
  [viewport.height, viewport.width]
3773
3606
  );
3774
- const floatingRef = (0, import_react24.useRef)(null);
3775
- const cachedFloatingPositionRef = (0, import_react24.useRef)(null);
3776
- const appliedFloatingCacheRef = (0, import_react24.useRef)(null);
3777
- const deferredScreenSnapRef = (0, import_react24.useRef)(null);
3778
- const [layoutMode, setLayoutMode] = (0, import_react24.useState)(
3607
+ const floatingRef = _react.useRef.call(void 0, null);
3608
+ const cachedFloatingPositionRef = _react.useRef.call(void 0, null);
3609
+ const appliedFloatingCacheRef = _react.useRef.call(void 0, null);
3610
+ const deferredScreenSnapRef = _react.useRef.call(void 0, null);
3611
+ const [layoutMode, setLayoutMode] = _react.useState.call(void 0,
3779
3612
  () => prefersMobileLayout ? "mobile" : "floating"
3780
3613
  );
3781
- const [floatingPosition, setFloatingPosition] = (0, import_react24.useState)(fallbackPosition);
3782
- const [dragPosition, setDragPosition] = (0, import_react24.useState)(null);
3783
- const [isDragging, setIsDragging] = (0, import_react24.useState)(false);
3784
- const dragStateRef = (0, import_react24.useRef)(null);
3785
- const overflowRetryRef = (0, import_react24.useRef)({
3614
+ const [floatingPosition, setFloatingPosition] = _react.useState.call(void 0, fallbackPosition);
3615
+ const [dragPosition, setDragPosition] = _react.useState.call(void 0, null);
3616
+ const [isDragging, setIsDragging] = _react.useState.call(void 0, false);
3617
+ const dragStateRef = _react.useRef.call(void 0, null);
3618
+ const overflowRetryRef = _react.useRef.call(void 0, {
3786
3619
  stepId: null,
3787
3620
  attempts: 0
3788
3621
  });
3789
- const overflowRetryTimeoutRef = (0, import_react24.useRef)(null);
3790
- (0, import_react24.useLayoutEffect)(() => {
3791
- if (!isBrowser) return;
3622
+ const overflowRetryTimeoutRef = _react.useRef.call(void 0, null);
3623
+ _react.useLayoutEffect.call(void 0, () => {
3624
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
3792
3625
  const node = floatingRef.current;
3793
3626
  if (!node) return;
3794
3627
  const updateSize = () => {
@@ -3801,30 +3634,30 @@ var TourPopoverPortal = ({
3801
3634
  observer.observe(node);
3802
3635
  return () => observer.disconnect();
3803
3636
  }, [target.stepId]);
3804
- const resolvedPlacement = placement ?? "bottom";
3637
+ const resolvedPlacement = _nullishCoalesce(placement, () => ( "bottom"));
3805
3638
  const isAutoPlacement = resolvedPlacement.startsWith("auto");
3806
3639
  const autoAlignment = resolvedPlacement.endsWith(
3807
3640
  "-start"
3808
3641
  ) ? "start" : resolvedPlacement.endsWith("-end") ? "end" : void 0;
3809
- (0, import_react24.useEffect)(() => {
3642
+ _react.useEffect.call(void 0, () => {
3810
3643
  setDragPosition(null);
3811
3644
  setLayoutMode(prefersMobileRef.current ? "mobile" : "floating");
3812
3645
  cachedFloatingPositionRef.current = null;
3813
3646
  appliedFloatingCacheRef.current = null;
3814
3647
  }, [target.stepId]);
3815
- (0, import_react24.useEffect)(() => {
3648
+ _react.useEffect.call(void 0, () => {
3816
3649
  if (layoutMode !== "manual") {
3817
3650
  setDragPosition(null);
3818
3651
  }
3819
3652
  }, [layoutMode]);
3820
- (0, import_react24.useEffect)(() => {
3653
+ _react.useEffect.call(void 0, () => {
3821
3654
  cachedFloatingPositionRef.current = floatingPosition;
3822
3655
  const cacheKey = getFloatingCacheKey(target);
3823
3656
  if (cacheKey) {
3824
3657
  floatingPositionCache.set(cacheKey, floatingPosition);
3825
3658
  }
3826
3659
  }, [floatingPosition, target.isScreen, target.stepId]);
3827
- const dockedPosition = (0, import_react24.useMemo)(
3660
+ const dockedPosition = _react.useMemo.call(void 0,
3828
3661
  () => ({
3829
3662
  top: viewport.height - DOCKED_MARGIN,
3830
3663
  left: viewport.width - DOCKED_MARGIN,
@@ -3832,7 +3665,7 @@ var TourPopoverPortal = ({
3832
3665
  }),
3833
3666
  [viewport.height, viewport.width]
3834
3667
  );
3835
- const mobilePosition = (0, import_react24.useMemo)(
3668
+ const mobilePosition = _react.useMemo.call(void 0,
3836
3669
  () => ({
3837
3670
  top: viewport.height - MOBILE_HORIZONTAL_GUTTER,
3838
3671
  left: viewport.width / 2,
@@ -3840,17 +3673,17 @@ var TourPopoverPortal = ({
3840
3673
  }),
3841
3674
  [viewport.height, viewport.width]
3842
3675
  );
3843
- (0, import_react24.useEffect)(() => {
3676
+ _react.useEffect.call(void 0, () => {
3844
3677
  if (layoutMode === "docked") {
3845
3678
  setFloatingPosition(dockedPosition);
3846
3679
  }
3847
3680
  }, [dockedPosition, layoutMode]);
3848
- (0, import_react24.useEffect)(() => {
3681
+ _react.useEffect.call(void 0, () => {
3849
3682
  if (layoutMode === "mobile") {
3850
3683
  setFloatingPosition(mobilePosition);
3851
3684
  }
3852
3685
  }, [layoutMode, mobilePosition]);
3853
- (0, import_react24.useEffect)(() => {
3686
+ _react.useEffect.call(void 0, () => {
3854
3687
  if (prefersMobileLayout) {
3855
3688
  if (layoutMode !== "mobile") {
3856
3689
  setLayoutMode("mobile");
@@ -3863,13 +3696,13 @@ var TourPopoverPortal = ({
3863
3696
  setFloatingPosition(fallbackPosition);
3864
3697
  }
3865
3698
  }, [fallbackPosition, layoutMode, prefersMobileLayout]);
3866
- (0, import_react24.useEffect)(() => {
3699
+ _react.useEffect.call(void 0, () => {
3867
3700
  if (layoutMode !== "floating") return;
3868
3701
  const stepId = target.stepId;
3869
3702
  if (!stepId) return;
3870
3703
  if (appliedFloatingCacheRef.current === stepId) return;
3871
3704
  const cacheKey = getFloatingCacheKey(target);
3872
- const cached = cacheKey ? floatingPositionCache.get(cacheKey) ?? null : null;
3705
+ const cached = cacheKey ? _nullishCoalesce(floatingPositionCache.get(cacheKey), () => ( null)) : null;
3873
3706
  if (cached) {
3874
3707
  appliedFloatingCacheRef.current = stepId;
3875
3708
  setFloatingPosition(cached);
@@ -3887,7 +3720,7 @@ var TourPopoverPortal = ({
3887
3720
  target.stepId
3888
3721
  ]);
3889
3722
  const shouldDeferScreenSnap = layoutMode === "floating" && target.isScreen && Boolean(layoutId);
3890
- (0, import_react24.useEffect)(() => {
3723
+ _react.useEffect.call(void 0, () => {
3891
3724
  return () => {
3892
3725
  if (deferredScreenSnapRef.current !== null) {
3893
3726
  cancelAnimationFrame(deferredScreenSnapRef.current);
@@ -3895,7 +3728,7 @@ var TourPopoverPortal = ({
3895
3728
  }
3896
3729
  };
3897
3730
  }, []);
3898
- (0, import_react24.useLayoutEffect)(() => {
3731
+ _react.useLayoutEffect.call(void 0, () => {
3899
3732
  if (layoutMode !== "floating") return;
3900
3733
  if (target.status === "ready" && !target.isScreen) return;
3901
3734
  if (shouldDeferScreenSnap) return;
@@ -3907,7 +3740,7 @@ var TourPopoverPortal = ({
3907
3740
  target.isScreen,
3908
3741
  target.status
3909
3742
  ]);
3910
- (0, import_react24.useEffect)(() => {
3743
+ _react.useEffect.call(void 0, () => {
3911
3744
  if (!shouldDeferScreenSnap) return;
3912
3745
  if (deferredScreenSnapRef.current !== null) {
3913
3746
  cancelAnimationFrame(deferredScreenSnapRef.current);
@@ -3934,15 +3767,15 @@ var TourPopoverPortal = ({
3934
3767
  }
3935
3768
  };
3936
3769
  }, [fallbackPosition, shouldDeferScreenSnap]);
3937
- (0, import_react24.useEffect)(() => {
3770
+ _react.useEffect.call(void 0, () => {
3938
3771
  return () => {
3939
3772
  if (overflowRetryTimeoutRef.current !== null) {
3940
3773
  window.clearTimeout(overflowRetryTimeoutRef.current);
3941
3774
  }
3942
3775
  };
3943
3776
  }, []);
3944
- (0, import_react24.useLayoutEffect)(() => {
3945
- if (!isBrowser) return;
3777
+ _react.useLayoutEffect.call(void 0, () => {
3778
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
3946
3779
  const floatingEl = floatingRef.current;
3947
3780
  const rectInfo = target.rect;
3948
3781
  if (!floatingEl) return;
@@ -3951,7 +3784,7 @@ var TourPopoverPortal = ({
3951
3784
  if (layoutMode === "mobile" || layoutMode === "manual") return;
3952
3785
  const cancelState = { cancelled: false };
3953
3786
  const retryState = overflowRetryRef.current;
3954
- const currentStepId = target.stepId ?? null;
3787
+ const currentStepId = _nullishCoalesce(target.stepId, () => ( null));
3955
3788
  if (retryState.stepId !== currentStepId) {
3956
3789
  retryState.stepId = currentStepId;
3957
3790
  retryState.attempts = 0;
@@ -3963,7 +3796,7 @@ var TourPopoverPortal = ({
3963
3796
  }
3964
3797
  };
3965
3798
  const virtualReference = {
3966
- contextElement: target.element ?? void 0,
3799
+ contextElement: _nullishCoalesce(target.element, () => ( void 0)),
3967
3800
  getBoundingClientRect: () => DOMRectReadOnly.fromRect({
3968
3801
  width: rectInfo.width,
3969
3802
  height: rectInfo.height,
@@ -3973,31 +3806,31 @@ var TourPopoverPortal = ({
3973
3806
  };
3974
3807
  const computePlacement = isAutoPlacement ? void 0 : resolvedPlacement;
3975
3808
  const middleware = [
3976
- (0, import_dom13.offset)(offset),
3809
+ _dom.offset.call(void 0, offset),
3977
3810
  ...isAutoPlacement ? [
3978
- (0, import_dom13.autoPlacement)({
3811
+ _dom.autoPlacement.call(void 0, {
3979
3812
  padding: FLOATING_OFFSET,
3980
3813
  alignment: autoAlignment
3981
3814
  })
3982
3815
  ] : [
3983
- (0, import_dom13.flip)({
3816
+ _dom.flip.call(void 0, {
3984
3817
  padding: FLOATING_OFFSET,
3985
3818
  fallbackStrategy: "bestFit",
3986
3819
  crossAxis: true,
3987
3820
  fallbackPlacements: ["bottom", "top", "right", "left"]
3988
3821
  })
3989
3822
  ],
3990
- (0, import_dom13.shift)({ padding: FLOATING_OFFSET })
3823
+ _dom.shift.call(void 0, { padding: FLOATING_OFFSET })
3991
3824
  ];
3992
3825
  const updatePosition = async () => {
3993
- const { x, y } = await (0, import_dom13.computePosition)(virtualReference, floatingEl, {
3826
+ const { x, y } = await _dom.computePosition.call(void 0, virtualReference, floatingEl, {
3994
3827
  placement: computePlacement,
3995
3828
  strategy: "fixed",
3996
3829
  middleware
3997
3830
  });
3998
3831
  if (cancelState.cancelled) return;
3999
3832
  const floatingBox = floatingEl.getBoundingClientRect();
4000
- const viewportRect = getViewportRect();
3833
+ const viewportRect = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
4001
3834
  const viewportTop = viewportRect.top;
4002
3835
  const viewportBottom = viewportRect.top + viewportRect.height;
4003
3836
  const viewportLeft = viewportRect.left;
@@ -4083,7 +3916,7 @@ var TourPopoverPortal = ({
4083
3916
  target.status,
4084
3917
  target.stepId
4085
3918
  ]);
4086
- (0, import_react24.useLayoutEffect)(() => {
3919
+ _react.useLayoutEffect.call(void 0, () => {
4087
3920
  if (layoutMode !== "manual" || !dragPosition) return;
4088
3921
  setFloatingPosition({
4089
3922
  top: dragPosition.top,
@@ -4092,10 +3925,10 @@ var TourPopoverPortal = ({
4092
3925
  });
4093
3926
  }, [dragPosition, layoutMode]);
4094
3927
  const clampToViewport = (rawLeft, rawTop) => {
4095
- const rect = getViewportRect();
3928
+ const rect = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
4096
3929
  const floatingEl = floatingRef.current;
4097
- const floatingElWidth = floatingEl?.offsetWidth ?? 0;
4098
- const floatingElHeight = floatingEl?.offsetHeight ?? 0;
3930
+ const floatingElWidth = _nullishCoalesce(_optionalChain([floatingEl, 'optionalAccess', _161 => _161.offsetWidth]), () => ( 0));
3931
+ const floatingElHeight = _nullishCoalesce(_optionalChain([floatingEl, 'optionalAccess', _162 => _162.offsetHeight]), () => ( 0));
4099
3932
  const minLeft = rect.left + FLOATING_OFFSET;
4100
3933
  const maxLeft = rect.left + rect.width - floatingElWidth - FLOATING_OFFSET;
4101
3934
  const minTop = rect.top + FLOATING_OFFSET;
@@ -4132,7 +3965,7 @@ var TourPopoverPortal = ({
4132
3965
  if (supportsRelease && hasCapture) {
4133
3966
  try {
4134
3967
  floatingEl.releasePointerCapture(dragState.pointerId);
4135
- } catch {
3968
+ } catch (e4) {
4136
3969
  }
4137
3970
  }
4138
3971
  }
@@ -4163,16 +3996,16 @@ var TourPopoverPortal = ({
4163
3996
  if (supportsPointerCapture) {
4164
3997
  try {
4165
3998
  floatingEl.setPointerCapture(event.pointerId);
4166
- } catch {
3999
+ } catch (e5) {
4167
4000
  }
4168
4001
  }
4169
4002
  event.preventDefault();
4170
4003
  };
4171
- (0, import_react24.useEffect)(() => endDrag, []);
4004
+ _react.useEffect.call(void 0, () => endDrag, []);
4172
4005
  const shouldUseFallbackInitial = layoutMode !== "mobile" && (Boolean(target.lastResolvedRect) || Boolean(cachedTarget));
4173
4006
  const floatingCacheKey = layoutMode === "mobile" ? null : getFloatingCacheKey(target);
4174
- const persistedFloatingInitial = floatingCacheKey && floatingPositionCache.has(floatingCacheKey) ? floatingPositionCache.get(floatingCacheKey) ?? null : null;
4175
- const cachedFloatingInitial = layoutMode === "mobile" ? null : cachedFloatingPositionRef.current ?? persistedFloatingInitial;
4007
+ const persistedFloatingInitial = floatingCacheKey && floatingPositionCache.has(floatingCacheKey) ? _nullishCoalesce(floatingPositionCache.get(floatingCacheKey), () => ( null)) : null;
4008
+ const cachedFloatingInitial = layoutMode === "mobile" ? null : _nullishCoalesce(cachedFloatingPositionRef.current, () => ( persistedFloatingInitial));
4176
4009
  const hasCachedFloatingInitial = Boolean(cachedFloatingInitial);
4177
4010
  const resolvedInitialPosition = layoutMode === "mobile" ? mobilePosition : hasCachedFloatingInitial && cachedFloatingInitial ? cachedFloatingInitial : shouldUseFallbackInitial ? fallbackPosition : centerInitialPosition;
4178
4011
  const initialTop = resolvedInitialPosition.top;
@@ -4188,12 +4021,12 @@ var TourPopoverPortal = ({
4188
4021
  };
4189
4022
  const setFloatingNode = (node) => {
4190
4023
  floatingRef.current = node;
4191
- onContainerChange?.(node);
4024
+ _optionalChain([onContainerChange, 'optionalCall', _163 => _163(node)]);
4192
4025
  };
4193
4026
  const containerProps = {
4194
4027
  ref: setFloatingNode,
4195
- role: role ?? "dialog",
4196
- "aria-modal": ariaModal ?? false,
4028
+ role: _nullishCoalesce(role, () => ( "dialog")),
4029
+ "aria-modal": _nullishCoalesce(ariaModal, () => ( false)),
4197
4030
  "aria-label": ariaLabel,
4198
4031
  "aria-describedby": ariaDescribedBy,
4199
4032
  tabIndex: -1,
@@ -4226,7 +4059,7 @@ var TourPopoverPortal = ({
4226
4059
  ...layoutId ? { layoutId } : {}
4227
4060
  };
4228
4061
  const contentProps = {
4229
- key: target.stepId ?? void 0,
4062
+ key: _nullishCoalesce(target.stepId, () => ( void 0)),
4230
4063
  "data-tour-popover-content": "",
4231
4064
  initial: { opacity: 0, translateX: 0, filter: "blur(4px)" },
4232
4065
  animate: { opacity: 1, translateX: 0, filter: "blur(0px)" },
@@ -4256,12 +4089,12 @@ var TourPopoverPortal = ({
4256
4089
  descriptionProps
4257
4090
  };
4258
4091
  if (shouldHidePopover) return null;
4259
- return (0, import_react_dom2.createPortal)(children(context), host);
4092
+ return _reactdom.createPortal.call(void 0, children(context), host);
4260
4093
  };
4261
4094
 
4262
4095
  // src/components/TourFocusManager.tsx
4263
- var import_react25 = require("react");
4264
- var import_react_dom3 = require("react-dom");
4096
+
4097
+
4265
4098
 
4266
4099
  // src/utils/focus.ts
4267
4100
  var FOCUSABLE_SELECTOR = 'a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [contenteditable="true"], [tabindex]';
@@ -4315,13 +4148,13 @@ var getFocusableIn = (root) => {
4315
4148
  var focusElement = (element, options) => {
4316
4149
  if (!element) return;
4317
4150
  try {
4318
- element.focus(options ?? { preventScroll: true });
4319
- } catch {
4151
+ element.focus(_nullishCoalesce(options, () => ( { preventScroll: true })));
4152
+ } catch (e6) {
4320
4153
  }
4321
4154
  };
4322
4155
 
4323
4156
  // src/components/TourFocusManager.tsx
4324
- var import_jsx_runtime5 = require("react/jsx-runtime");
4157
+
4325
4158
  var runMicrotask = (callback) => {
4326
4159
  if (typeof queueMicrotask === "function") {
4327
4160
  queueMicrotask(callback);
@@ -4337,18 +4170,18 @@ var TourFocusManager = ({
4337
4170
  highlightRect,
4338
4171
  guardElementFocusRing
4339
4172
  }) => {
4340
- const previousFocusRef = (0, import_react25.useRef)(null);
4341
- const guardNodesRef = (0, import_react25.useRef)({
4173
+ const previousFocusRef = _react.useRef.call(void 0, null);
4174
+ const guardNodesRef = _react.useRef.call(void 0, {
4342
4175
  "target-start": null,
4343
4176
  "target-end": null,
4344
4177
  "popover-start": null,
4345
4178
  "popover-end": null
4346
4179
  });
4347
- const lastTabDirectionRef = (0, import_react25.useRef)("forward");
4348
- const suppressGuardHopRef = (0, import_react25.useRef)(null);
4349
- const [targetRingActive, setTargetRingActive] = (0, import_react25.useState)(false);
4350
- const [popoverRingActive, setPopoverRingActive] = (0, import_react25.useState)(false);
4351
- const [popoverRect, setPopoverRect] = (0, import_react25.useState)(null);
4180
+ const lastTabDirectionRef = _react.useRef.call(void 0, "forward");
4181
+ const suppressGuardHopRef = _react.useRef.call(void 0, null);
4182
+ const [targetRingActive, setTargetRingActive] = _react.useState.call(void 0, false);
4183
+ const [popoverRingActive, setPopoverRingActive] = _react.useState.call(void 0, false);
4184
+ const [popoverRect, setPopoverRect] = _react.useState.call(void 0, null);
4352
4185
  const restoreFocus = () => {
4353
4186
  const previous = previousFocusRef.current;
4354
4187
  previousFocusRef.current = null;
@@ -4358,15 +4191,15 @@ var TourFocusManager = ({
4358
4191
  });
4359
4192
  }
4360
4193
  };
4361
- (0, import_react25.useLayoutEffect)(() => {
4362
- if (!isBrowser) return;
4194
+ _react.useLayoutEffect.call(void 0, () => {
4195
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
4363
4196
  if (!active) {
4364
4197
  restoreFocus();
4365
4198
  return;
4366
4199
  }
4367
4200
  if (previousFocusRef.current) return;
4368
- const doc = popoverNode?.ownerDocument ?? target.element?.ownerDocument;
4369
- const activeEl = (doc ?? document).activeElement;
4201
+ const doc = _nullishCoalesce(_optionalChain([popoverNode, 'optionalAccess', _164 => _164.ownerDocument]), () => ( _optionalChain([target, 'access', _165 => _165.element, 'optionalAccess', _166 => _166.ownerDocument])));
4202
+ const activeEl = (_nullishCoalesce(doc, () => ( document))).activeElement;
4370
4203
  if (activeEl instanceof HTMLElement) {
4371
4204
  previousFocusRef.current = activeEl;
4372
4205
  }
@@ -4374,10 +4207,10 @@ var TourFocusManager = ({
4374
4207
  restoreFocus();
4375
4208
  };
4376
4209
  }, [active, popoverNode, target.element]);
4377
- (0, import_react25.useEffect)(() => {
4378
- if (!isBrowser) return;
4210
+ _react.useEffect.call(void 0, () => {
4211
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
4379
4212
  if (!active) return;
4380
- const doc = popoverNode?.ownerDocument ?? target.element?.ownerDocument ?? document;
4213
+ const doc = _nullishCoalesce(_nullishCoalesce(_optionalChain([popoverNode, 'optionalAccess', _167 => _167.ownerDocument]), () => ( _optionalChain([target, 'access', _168 => _168.element, 'optionalAccess', _169 => _169.ownerDocument]))), () => ( document));
4381
4214
  const createGuard = (key) => {
4382
4215
  const node = doc.createElement("div");
4383
4216
  node.tabIndex = 0;
@@ -4407,7 +4240,7 @@ var TourFocusManager = ({
4407
4240
  const removeGuards = () => {
4408
4241
  for (const key of Object.keys(guardNodesRef.current)) {
4409
4242
  const node = guardNodesRef.current[key];
4410
- if (node?.parentNode) {
4243
+ if (_optionalChain([node, 'optionalAccess', _170 => _170.parentNode])) {
4411
4244
  node.parentNode.removeChild(node);
4412
4245
  }
4413
4246
  guardNodesRef.current[key] = null;
@@ -4416,7 +4249,7 @@ var TourFocusManager = ({
4416
4249
  };
4417
4250
  const ensureGuards = () => {
4418
4251
  const targetElement = !target.isScreen && target.element instanceof HTMLElement ? target.element : null;
4419
- const popoverElement = popoverNode ?? null;
4252
+ const popoverElement = _nullishCoalesce(popoverNode, () => ( null));
4420
4253
  if (targetElement) {
4421
4254
  if (!guardNodesRef.current["target-start"]) {
4422
4255
  guardNodesRef.current["target-start"] = createGuard("target-start");
@@ -4435,7 +4268,7 @@ var TourFocusManager = ({
4435
4268
  } else {
4436
4269
  for (const key of ["target-start", "target-end"]) {
4437
4270
  const node = guardNodesRef.current[key];
4438
- if (node?.parentNode) {
4271
+ if (_optionalChain([node, 'optionalAccess', _171 => _171.parentNode])) {
4439
4272
  node.parentNode.removeChild(node);
4440
4273
  }
4441
4274
  guardNodesRef.current[key] = null;
@@ -4459,7 +4292,7 @@ var TourFocusManager = ({
4459
4292
  } else {
4460
4293
  for (const key of ["popover-start", "popover-end"]) {
4461
4294
  const node = guardNodesRef.current[key];
4462
- if (node?.parentNode) {
4295
+ if (_optionalChain([node, 'optionalAccess', _172 => _172.parentNode])) {
4463
4296
  node.parentNode.removeChild(node);
4464
4297
  }
4465
4298
  guardNodesRef.current[key] = null;
@@ -4479,7 +4312,7 @@ var TourFocusManager = ({
4479
4312
  }
4480
4313
  nodes.push(...getFocusableIn(targetElement));
4481
4314
  }
4482
- if (nodes.length === 0 && popoverNode?.hasAttribute("tabindex")) {
4315
+ if (nodes.length === 0 && _optionalChain([popoverNode, 'optionalAccess', _173 => _173.hasAttribute, 'call', _174 => _174("tabindex")])) {
4483
4316
  nodes.push(popoverNode);
4484
4317
  }
4485
4318
  const unique = [];
@@ -4493,7 +4326,7 @@ var TourFocusManager = ({
4493
4326
  };
4494
4327
  const isWithinTrap = (element) => {
4495
4328
  if (!(element instanceof HTMLElement)) return false;
4496
- if (popoverNode?.contains(element)) return true;
4329
+ if (_optionalChain([popoverNode, 'optionalAccess', _175 => _175.contains, 'call', _176 => _176(element)])) return true;
4497
4330
  if (target.element instanceof HTMLElement && target.element.contains(element)) {
4498
4331
  return true;
4499
4332
  }
@@ -4502,7 +4335,7 @@ var TourFocusManager = ({
4502
4335
  );
4503
4336
  };
4504
4337
  const ensureFocus = () => {
4505
- const firstGuard = guardNodesRef.current["target-start"] ?? guardNodesRef.current["popover-start"];
4338
+ const firstGuard = _nullishCoalesce(guardNodesRef.current["target-start"], () => ( guardNodesRef.current["popover-start"]));
4506
4339
  if (firstGuard) {
4507
4340
  focusElement(firstGuard);
4508
4341
  return;
@@ -4537,10 +4370,10 @@ var TourFocusManager = ({
4537
4370
  }
4538
4371
  }
4539
4372
  const key = targetNode.getAttribute("data-tour-focus-guard");
4540
- if (key?.startsWith("target")) {
4373
+ if (_optionalChain([key, 'optionalAccess', _177 => _177.startsWith, 'call', _178 => _178("target")])) {
4541
4374
  setTargetRingActive(true);
4542
4375
  setPopoverRingActive(false);
4543
- } else if (key?.startsWith("popover")) {
4376
+ } else if (_optionalChain([key, 'optionalAccess', _179 => _179.startsWith, 'call', _180 => _180("popover")])) {
4544
4377
  setTargetRingActive(false);
4545
4378
  setPopoverRingActive(true);
4546
4379
  }
@@ -4568,23 +4401,23 @@ var TourFocusManager = ({
4568
4401
  target.stepId,
4569
4402
  target.visibility
4570
4403
  ]);
4571
- (0, import_react25.useLayoutEffect)(() => {
4404
+ _react.useLayoutEffect.call(void 0, () => {
4572
4405
  if (popoverRingActive && popoverNode) {
4573
4406
  setPopoverRect(popoverNode.getBoundingClientRect());
4574
4407
  } else {
4575
4408
  setPopoverRect(null);
4576
4409
  }
4577
4410
  }, [popoverRingActive, popoverNode]);
4578
- if (!isBrowser) return null;
4579
- const host = portalHost();
4411
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
4412
+ const host = _chunkD5LQLRSUcjs.portalHost.call(void 0, );
4580
4413
  if (!host) return null;
4581
- const boxShadow = guardElementFocusRing?.boxShadow ?? DEFAULT_BOX_SHADOW;
4414
+ const boxShadow = _nullishCoalesce(_optionalChain([guardElementFocusRing, 'optionalAccess', _181 => _181.boxShadow]), () => ( DEFAULT_BOX_SHADOW));
4582
4415
  const showTargetRing = targetRingActive && highlightRect;
4583
4416
  const showPopoverRing = popoverRingActive && popoverRect;
4584
4417
  if (!showTargetRing && !showPopoverRing) return null;
4585
- return (0, import_react_dom3.createPortal)(
4586
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
4587
- showTargetRing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4418
+ return _reactdom.createPortal.call(void 0,
4419
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
4420
+ showTargetRing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4588
4421
  "div",
4589
4422
  {
4590
4423
  style: {
@@ -4601,7 +4434,7 @@ var TourFocusManager = ({
4601
4434
  "aria-hidden": true
4602
4435
  }
4603
4436
  ),
4604
- showPopoverRing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4437
+ showPopoverRing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4605
4438
  "div",
4606
4439
  {
4607
4440
  style: {
@@ -4624,7 +4457,7 @@ var TourFocusManager = ({
4624
4457
  };
4625
4458
 
4626
4459
  // src/motion/useHudMotion.ts
4627
- var import_react26 = require("react");
4460
+
4628
4461
  var DEFAULT_HIGHLIGHT_TRANSITION2 = {
4629
4462
  duration: 0.35,
4630
4463
  ease: "easeOut",
@@ -4651,61 +4484,60 @@ var DEFAULT_POPOVER_CONTENT_TRANSITION2 = {
4651
4484
  };
4652
4485
  var useHudMotion = () => {
4653
4486
  const adapter = useAnimationAdapter();
4654
- return (0, import_react26.useMemo)(() => {
4487
+ return _react.useMemo.call(void 0, () => {
4655
4488
  const components = {
4656
4489
  ...adapter.components
4657
4490
  };
4658
4491
  return {
4659
4492
  components,
4660
4493
  transitions: {
4661
- highlight: adapter.transitions.overlayHighlight ?? DEFAULT_HIGHLIGHT_TRANSITION2,
4662
- overlayFade: adapter.transitions.overlayFade ?? DEFAULT_OVERLAY_TRANSITION2,
4663
- popoverEntrance: adapter.transitions.popoverEntrance ?? DEFAULT_POPOVER_ENTRANCE_TRANSITION2,
4664
- popoverExit: adapter.transitions.popoverExit ?? DEFAULT_POPOVER_EXIT_TRANSITION2,
4665
- popoverContent: adapter.transitions.popoverContent ?? DEFAULT_POPOVER_CONTENT_TRANSITION2
4494
+ highlight: _nullishCoalesce(adapter.transitions.overlayHighlight, () => ( DEFAULT_HIGHLIGHT_TRANSITION2)),
4495
+ overlayFade: _nullishCoalesce(adapter.transitions.overlayFade, () => ( DEFAULT_OVERLAY_TRANSITION2)),
4496
+ popoverEntrance: _nullishCoalesce(adapter.transitions.popoverEntrance, () => ( DEFAULT_POPOVER_ENTRANCE_TRANSITION2)),
4497
+ popoverExit: _nullishCoalesce(adapter.transitions.popoverExit, () => ( DEFAULT_POPOVER_EXIT_TRANSITION2)),
4498
+ popoverContent: _nullishCoalesce(adapter.transitions.popoverContent, () => ( DEFAULT_POPOVER_CONTENT_TRANSITION2))
4666
4499
  }
4667
4500
  };
4668
4501
  }, [adapter]);
4669
4502
  };
4670
- // Annotate the CommonJS export names for ESM import in node:
4671
- 0 && (module.exports = {
4672
- AnimationAdapterProvider,
4673
- DialogRegistryProvider,
4674
- OverlayBackdrop,
4675
- TourFocusManager,
4676
- TourPopoverPortal,
4677
- TourProvider,
4678
- createPathString,
4679
- createWaitForPredicateController,
4680
- defaultAnimationAdapter,
4681
- defaultLabels,
4682
- getCurrentRoutePath,
4683
- notifyRouteChange,
4684
- reducedMotionAnimationAdapter,
4685
- subscribeToRouteChanges,
4686
- useAdvanceRules,
4687
- useAnimationAdapter,
4688
- useBodyScrollLock,
4689
- useDelayAdvance,
4690
- useDialogRegistry,
4691
- useDialogRegistryOptional,
4692
- useHiddenTargetFallback,
4693
- useHudDescription,
4694
- useHudMotion,
4695
- useHudShortcuts,
4696
- useHudState,
4697
- useHudTargetIssue,
4698
- usePreferredAnimationAdapter,
4699
- useRadixDialogAdapter,
4700
- useRadixTourDialog,
4701
- useTour,
4702
- useTourControls,
4703
- useTourEvents,
4704
- useTourFocusDominance,
4705
- useTourHud,
4706
- useTourLabels,
4707
- useTourOverlay,
4708
- useTourTarget,
4709
- useViewportRect,
4710
- waitForDom
4711
- });
4503
+
4504
+
4505
+
4506
+
4507
+
4508
+
4509
+
4510
+
4511
+
4512
+
4513
+
4514
+
4515
+
4516
+
4517
+
4518
+
4519
+
4520
+
4521
+
4522
+
4523
+
4524
+
4525
+
4526
+
4527
+
4528
+
4529
+
4530
+
4531
+
4532
+
4533
+
4534
+
4535
+
4536
+
4537
+
4538
+
4539
+
4540
+
4541
+
4542
+
4543
+ exports.AnimationAdapterProvider = AnimationAdapterProvider; exports.DialogRegistryProvider = DialogRegistryProvider; exports.OverlayBackdrop = OverlayBackdrop; exports.TourFocusManager = TourFocusManager; exports.TourPopoverPortal = TourPopoverPortal; exports.TourProvider = TourProvider; exports.createPathString = _chunkD5LQLRSUcjs.createPathString; exports.createWaitForPredicateController = createWaitForPredicateController; exports.defaultAnimationAdapter = defaultAnimationAdapter; exports.defaultLabels = defaultLabels; exports.getCurrentRoutePath = _chunkD5LQLRSUcjs.getCurrentRoutePath; exports.notifyRouteChange = _chunkD5LQLRSUcjs.notifyRouteChange; exports.reducedMotionAnimationAdapter = reducedMotionAnimationAdapter; exports.subscribeToRouteChanges = _chunkD5LQLRSUcjs.subscribeToRouteChanges; exports.useAdvanceRules = useAdvanceRules; exports.useAnimationAdapter = useAnimationAdapter; exports.useBodyScrollLock = useBodyScrollLock; exports.useDelayAdvance = useDelayAdvance; exports.useDialogRegistry = useDialogRegistry; exports.useDialogRegistryOptional = useDialogRegistryOptional; exports.useHiddenTargetFallback = useHiddenTargetFallback; exports.useHudDescription = useHudDescription; exports.useHudMotion = useHudMotion; exports.useHudShortcuts = useHudShortcuts; exports.useHudState = useHudState; exports.useHudTargetIssue = useHudTargetIssue; exports.usePreferredAnimationAdapter = usePreferredAnimationAdapter; exports.useRadixDialogAdapter = useRadixDialogAdapter; exports.useRadixTourDialog = useRadixTourDialog; exports.useTour = useTour; exports.useTourControls = useTourControls; exports.useTourEvents = useTourEvents; exports.useTourFocusDominance = useTourFocusDominance; exports.useTourHud = useTourHud; exports.useTourLabels = useTourLabels; exports.useTourOverlay = useTourOverlay; exports.useTourTarget = useTourTarget; exports.useViewportRect = useViewportRect; exports.waitForDom = waitForDom;